Robocopy – The Quickstart Guide

Robocopy is a great tool, but there are so many options/attributes to choose from, a simple copy script for a server migration can take more time than you’d care to spend. I typically create and run these commands from the new/destination server. Below are the quick steps you can use on a new server to:

  • Copy all files/folders, retaining their timestamps, from source server to destination server
  • Log the outcome of the copy job so that you can kick it off, let it run, and check back later for any files that may have had issues
  • Modify your copy job to only capture only incremental file/folder changes after your initial large file copy


FULL COPY (with log):

robocopy “\\Source_Server\Data_Share” “D:\Data_Share” /NP /TEE /MT:32 /E /R:3 /W:5 /ZB /COPY:DT /LOG:”C:\Users\administrator\Desktop\data_share_log.txt”



robocopy “\\Source_Server\Data_Share” “D:\Data_Share” /NP /TEE /MT:32 /E /R:3 /W:5 /ZB /MIR /COPY:DT /LOG:”C:\Users\administrator\Desktop\data_share_log.txt”


The two commands/examples above are identical minus one attribute, /MIR. Typically, I use the first example to do the initial large copy. Let it run all night, and then check the log file on the desktop the following morning searching for the word ‘error’. If you have to postpone your ‘new server cutover date’, the second example comes in handy. It will only copy files from the source destination that are new or newer than what already is in the destination. It’s much more efficient than redoing the entire copy job, and very helpful for keeping the new directory up and in-sync with the source.

The full list of available robocopy attributes is available here. The quick reference for the ones in my example are here:

/NP – Specifies that the progress of the copying operation (the number of files or directories copied so far) will not be displayed.
/TEE – Writes the status output to the console window, as well as to the log file.
/MT:<N> – Creates multi-threaded copies with N threads. N must be an integer between 1 and 128. The default value for N is 8.
/E – Copies subdirectories. Note that this option includes empty directories.
/R:<N> – Specifies the number of retries on failed copies. The default value of N is 1,000,000 (one million retries).
/W:<N> – Specifies the wait time between retries, in seconds. The default value of N is 30 (wait time 30 seconds).
/ZB – Uses Restart mode. If access is denied, this option uses Backup mode.
/MIR – Mirrors a directory tree (equivalent to /e plus /purge).
/COPY:DT – Specifies the file properties to be copied. (D=Data, T=Timestamp)
/LOG:<LogFile> – Writes the status output to the log file (overwrites the existing log file).

Leave a Reply

Your email address will not be published. Required fields are marked *