Try this,
// Get your source and destination libraries
SPList source = web.GetList(web.ServerRelativeUrl + @"/SourceDocLib");
SPList destination = web.GetList(web.ServerRelativeUrl + @"/DestinationDocLib");
// Get the collection of items to move, use source.GetItems(SPQuery) if you want a subset
SPListItemCollection items = items = source.Items;
// Get the root folder of the destination we'll use this to add the files
SPFolder folder = web.GetFolder(destination.RootFolder.Url);
// Now to move the files and the metadata
foreach (SPListItem item in items)
{
//Get the file associated with the item
SPFile file = item.File;
// Create a new file in the destination library with the same properties
SPFile newFile = folder.Files.Add(folder.Url + "/" +file.Name, file.OpenBinary(),file.Properties,true);
// Optionally copy across the created/modified metadata
SPListItem newItem = newFile.Item;
newItem["Editor"] = item["Editor"];
newItem["Modified"] = item["Modified"];
newItem["Author"] = item["Author"];
newItem["Created"] = item["Created"];
// UpdateOverwriteVersion() will preserve the metadata added above.
newItem.UpdateOverwriteVersion();
}
If you want to delete the originals as well use for (int i = items.Count -1; i > -1 ; i--) instead of the foreach to iterate backwards through the collection and items[i].Recycle(); or items[i].Delete(); to recycle or delete the original after you have moved it.
To move the items into subfolders replace the line SPFolder folder = web.GetFolder(destination.RootFolder.Url); with code similar to the following:
// Set the name of the new destination subfolder
string newFolderName = "Sub Folder 1";
// Try to get the new subfolder so we can test to see if it exists and if not create it
SPFolder folder = web.GetFolder(destination.RootFolder.Url + "/" + newFolderName);
if (!folder.Exists)
{
// Add the new folder
SPListItem folderItem = destination.Folders.Add("", SPFileSystemObjectType.Folder, newFolderName);
folderItem.SystemUpdate();
// Get the folder after creating it
folder = web.GetFolder(destination.RootFolder.Url + "/" + newFolderName);
Console.WriteLine(@"Created folder ""{0}""", folder.Url);
}
I'll post this answer with your original post on StackOverflow as well in case people look there first.