Programmatically move the files from one document library to another library in SharePoint
In this blog we will be seeing how to move the files from one document library to another library in SharePoint using c#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
namespace MoveTo
{
class Program
{
static void Main(string[] args)
{
using (SPSite site = new SPSite("http://serverName:1111/SitePages/Home.aspx"))
{
using (SPWeb web = site.RootWeb)
{
SPFileCollection collFile = web.GetFolder("Shared Documents").Files;
int count = collFile.Count;
while(count!=0)
{
collFile[count-1].MoveTo("Destination Library/" + collFile[count-1].Name, true);
count--;
}
}
}
}
}
}


Bharat Bhushan KvPosted Apr 23, 2020, 2:32 AM EDT
Does it also includes Nested Folder Structure, Metadata, ContentTypes, Look ups etc. ? If no please get me the program for an Archival condition say for all Files Older than 1 Yr. Any File size limitation during this Moving process ?