Skip to main content


If you are familiar with rsync on Linux, you will appreciate this Windows command line tool - robocopy.

Robocopy stands for “Robust File Copy.” It is a built-in Windows utility tool for transfering files from one location to another. 


Robocopy Syntax and Flags

The basic syntax for robocopy is as follow:


There are also some flags you can use to fine tune the file transfer. Some are the most commonly used flags are:

/s Copies subdirectories and excludes empty directories
/e Copies subdirectories and includes empty directories

Specifies what to attribute to copy over. The attribute options are:

  • D - Data
  • A - Attributes
  • T - Time stamps
  • E - Extended attribute
  • X - Skip alt data streams
/purge Deletes destination files and directories that no longer exist in the source
/mir Mirrors the destination with the source (equivalent to /e plus /purge)
/mov Moves files, and deletes them from the source after they're copied
/move Moves files and directories, and deletes them from the source after they're copied
/r:<n> Specifies the number of retries on failed copies. The retry attempt is 1,000,000 retries if n is not specify
/w:<n> Specifies the wait time between retries, in seconds. The default wait time is 30 seconds if n is not specify
/log:<logfile> Logs the CMD output to the log file, and overwrites the existing log file if it exist
/log+:<logfile> Logs the CMD output to the log file, and appends to the existing log file if it exist

Below is what I personally use for my robocopy transfers:

robocopy SOURCE DESTINATION /E /DCOPY:DAT /R:4 /W:10 /LOG:C:\temp\robocopylog.txt

When finish running, you can see the stats of the robocopy from the log file.


Occasionally, I also use the /MIR option to keep the destination in sync with the source. This will copy over any difference from the source folder to the destination folder, and then delete from the destination folder that is no longer in the source folder.

robocopy SOURCE DESTINATION /MIR /E /DCOPY:DAT /R:4 /W:10 /LOG:C:\temp\robocopylog.txt