Microsoft SharePoint – Batch File Transferring Via Robocopy
Transferring files in-between SharePoint sites can sometimes be tricky and often times time consuming. When transferring files from WSS to MOSS, there is no inherent method to test for file consistency and version between an existing SharePoint 2003 site and MOSS 2007 site. We will use ROBOCOPY from the Windows Server 2003 Resource Kit Tools to export data from an existing document library to a local share which can then be encrypted and uploaded to send. Follow the steps outlined below:
First you will need to install the Windows Server 2003 Resource Kit Tools to either a Windows XP desktop or the Server 2003 server that the SharePoint 2003 site resides on. Once installed you, will have the ROBOCOPY command line tool available for use. The tools will reside in "C: Program Files Windows Resource Kits Tools" and can be accessed via the command line, or the shortcut to "Command Shell" via the Windows Resource Kit Tools program folder created in the Start Menu.
The next step will be to map an existing SharePoint 2003 Document Library to a Network Drive on the PC or Server that Robocopy is installed on. This can be done by going to My Computer, and then selecting Map Network Drive from the Tools file menu. In the window that appears you will need to select a drive letter that is available and not in use, and also type in a Folder name. The folder name will be formatted as follows, for example: http: \ example.phase2.com Docs DocLibrary, where example.phase2com is the portal name or address used to access the site, Docs is the sub site if the library Found in a sub site, and DocLibrary is the name of the document library we are going to export files from. Once this is mapped, it should show the contents of that document library within the root of that drive.
Finally we will need to export the data from that Document Library to a file folder for storage and subsequent uploading. As an example, the data we will export will be any data that has a modified date of 04/18/2008. You will first need to open the command prompt to use robocopy. Once in the command prompt, you will need to use the robocopy command line tool as follows:
robocopy z: * d: fileshare * / E / Z / COPY: DAT / MAXAGE: 20080418
In the above example, these are the criteria and switches used.
o z: * – File source, in this case we would have mapped the document library being export from to the Z: network drive on the PC
d: fileshare * – File destination, where the fileshare is on a local drive on the PC
o / S – Copy subdirectories and exclude empty ones
o / Z – Copies in restartable mode
o / COPY: DAT – Copies file Data, Attributes, and Timestamps
o / MAXAGE: 20080418 – Copies files with a last modified date of 04-18-2008 and Newer (Excludes files with a last modified date that is before 04-18-2008)
Running the script above will have robocopy read through the mapped drive and copy only those files newer than the date set. Once the export has been completed, the client will then be able to upload those files to us for upload into their MOSS site.
The above must be run for each Document Library that they would like to export and export only newer / updated data. This is because we can only map the Document Library from SharePoint and not the entire site.
Source by Adam M Smithson