If you want to copy files from a SharePoint Document Library to a local folder, you can use the following from the command prompt. This can also be placed in a .bat file.


robocopy is a command that's built-in to Windows

Create a .bat file called _Update_From_Sharepoint.bat that looks like this and place it into the local folder:

robocopy "<UNC FOLDER PATH>\." . /MIR /XF _Update_From_Sharepoint.bat

The <UNC FOLDER PATH> needs to be replaced with something like this: \\volume\PrjRoot\ProjectX\Project Documents\Iteration 4 Here's what it would look like:

robocopy "\\volume\PrjRoot\ProjectX\Project Documents\Iteration 4\." . /MIR /XF _Update_From_Sharepoint.bat

The /MIR switch will will mirror the files, copying only those files that are new or changed. But it will also delete local files if they don't exist on the SharePoint folder, so be careful.

The /XF _Update_From_Sharepoint.bat tells the command to ignore the .bat file itself (i.e. it doesn't get synchronized)

Using XCOPYEdit

If you don't want to use robocopy, you can use the following xcopy command instead:

xcopy "\\volume\PrjRoot\ProjectX\Project Documents\Iteration 4\*" /e /d /y

The /d ensures that it only copies changed files (this makes it faster) unlike robocopy, the xcopy command doesn't delete local files if they are deleted in the SharePoint folder.

Community content is available under CC-BY-SA unless otherwise noted.