This should be possible, I have find some examples but with list items, or entire sites, not with only a document library.
Id be happy if somebody can provide working code!!
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.Sign up to join this community
This is a response I posted elsewhere (the links below contain code segments. Export/Import SPWeb works with site, list, or document libraries) -
The quickest way would be to export the site/list/document library using the Export-SPWeb PowerShell command. Use Import-SPWeb for importing the file package (it can also use optional compression. See the -Path and other options in the Export-SPWeb command).
An example showing the use of the above method - Export / Import / Migrate document libraries across sites in SharePoint 2010.
UPDATE: A near-equivalent using C# SPExport/SPImport is given here - Using SPExport and SPImport: Part 1