I plan to migrate a file share from Windows server 2003 to Server 2012 R2 (It has more than 500 GB of data. FYI - It does not have DFS).

I thought of using below command for copying the data from source server to target server:

robocopy "\\Source server\folder\" "\\Target server\folder\" /S /E /COPY:DATSOU /R:1 /W:10 /TEE /log:<log path.txt>

During the cut over, I plan to run the same command again to copy any new/modified files.

Are there any issues with above command and do I need to include '/XO' during the cut over to exclude copying the existing files again?

  • What's the question here? – Jim B Dec 7 '15 at 16:10

I had the exact scenario earlier this year. To answer your question, there shouldn't be any issues with your Robocopy command. I would like to share the Robocopy command I used to migrate my file server to a new Server 2012 R2 VM.

Note: Use the same drive letters and the exact same file paths on your new Windows Server 2012 R2 server. Failing to do so will result in the share information not matching and your migration fail.

Details on the Robocopy switches:

 /e – Copy subdirectories, including empty ones
 /xj – Exclude junction points
/r:2 – 2 retries
/w:5 – 5 second wait between retries
  /v – Verbose output for skipped files
 /it – Include tweaked files (identical size/timestamp, but different attributes)
/purge – Delete destination files/directories that no longer exist in source
/copyall – Copy data, attributes, timestamps, security (ACLs), owner, auditing info

I ran this command from the Server 2012 R2 Server.

ROBOCOPY /e /xj /r:2 /w:5 /v /it /purge /copyall \\Server2003FileServer\c$\Data c:\Data

Then you can export the file share information from the 2003 server and then import the share information to the 2012 R2 server. I used the KB article here https://support.microsoft.com/en-us/kb/125996 to perform my share export.


The command you mentioned is fine and almost reaches the goal you've set. If you really would like to perform the 1:1 migration, I would suggest you to consider following options:

robocopy "\\Source server\folder\" "\\Target server\folder\" /MIR /COPY:DATSOU /ZB /R:1 /W:10 /TEE /log:<log path.txt>
  • /MIR - this will MIRror a directory tree - whatever exist in source, will be copied to target. Whatever does not exist in source, will be removed (deleted) from target. By this option you will make sure, that no old data (those already removed on source) will be migrated to new server. This option is equivalent to /E plus /PURGE.

  • /ZB - Use restartable mode; if access denied use Backup mode. Restartable Mode - With this option, should the copy be interrupted while any particular file is partially copied, the next execution of robocopy can pick up where it left off rather than re-copying the entire file. For example, when robocopy will work on huge file (2 GB) and interrupted, after 10 seconds (/W:10) it will try to copy it again (/R:1) but will start the copy from part where it ended (not again from the beginning). Backup Mode - has to do with how robocopy reads files from the source system. It allows the copying of files on which you might otherwise get an access denied error on either the file itself or while trying to copy the file's attributes/permissions. You do need to be running in an Administrator context or otherwise have backup rights to use this flag.

You don't need to include /XO option in your final script - robocopy skips old, not updated files.

  • 2
    When writing a log, recommend you also use /NP otherwise the log is full of 1%, 2%, 3%, etc... – Clayton Dec 7 '15 at 14:54

protected by Community Dec 11 '17 at 8:44

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.