The Ultimate Guide to Robocopy

Common Robocopy Syntax Reference

Why such a long blog post on a single utility? Just feast your eyes on the tables below. You have a lot of options to copy or move files with robocopy! You will more options in the individual sections.

These tables were built from the help syntax returned from robocopy /?. They’ve been broken up into more meaningful sections, added to over time and cleaned up to provide more useful info.

Source Options

Switch Explanation Default Behavior Equivalent Switch Notes
/S Copy subfolders
/E Copy subfolders including empty subfolders
/COPY:[DATSOU] Copy options /COPY:DAT D=Data, A=Attributes, T=Timestamps S=Security=NTFS ACLs, O=Owner info, U=aUditing info. File Data (D) always includes file Timestamps (T)
/SEC Copy files with SECurity /COPY:DATS
/DCOPY:T Copy directory timestamps
/COPYALL Copy ALL file info /COPY:DATSOU This will prevent dehydrating offline files and will instead copy the file’s tag (on emc VNX/Unity systems at least). This is not officially documented! If dehydration is what you need (reason i found this issue), you can’t copy the ACLs along your files. CREDIT: Monsieurx (Reddit)
/NOCOPY Copy NO file info useful with /PURGE
/A Copy only files with the Archive attribute set
/M like /A, but remove Archive attribute from source files
/LEV:n Only copy the top n LEVels of the source tree
/MAXAGE:n MAXimum file AGE – exclude files older than n days/date
/MINAGE:n MINimum file AGE – exclude files newer than n days/date If n < 1900 then n = no of days, else n = YYYYMMDD date
/FFT Assume FAT File Times 2-second date/time granularity. This replaces NTFS timestamps. Seems to be more reliable when transferring over a network.
/256 Turn off very long path (> 256 characters) support

Destination Options

Switch Explanation Default Behavior Equivalent Switch Notes
/A+:[RASHCNET] Set file attribute(s) on destination files + add
/A-:[RASHCNET] Remove file attribute(s) on destination files
/FAT Create destination files using 8.3 FAT file names only
/CREATE Create directory tree structure + zero-length files only
/DST Compensate for one-hour DST time differences

Copy Options

Switch Explanation Default Behavior Equivalent Switch Notes
/L List files only Don’t copy, timestamp or delete any files
/MOV Move files Delete from source after copying
/MOVE Move files and directories Delete from source after copying
/sl Copy file symbolic links instead of the target
/Z Copy files in restartable mode Survive a network glitch
/B Copy files in backup mode
/J Copy using unbuffered I/O Recommended for large files
/NOOFFLOAD Copy files without using the Windows copy offload mechanism https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh831628(v=ws.11)
/EFSRAW Copy any encrypted files using EFS RAW mode
/TIMFIX Fix file times on all files, even skipped files
/XO Exclude older if destination file exists and is the same date or newer than the source – don’t bother to overwrite it.
/XC Exclude changed files
/XN Exclude newer files
/XX Exclude files present in destination but not source /XX
/XF file [file]… Exclude files matching given names/paths/wildcards
/XD dirs [dirs]… Exclude directories matching given names/paths. /XF and /XD can be used in combination e.g. ROBOCOPY c:\source d:\dest /XF *.doc *.xls /XD c:\unwanted /S
/IA:[RASHCNETO] Include files with any of the given attributes
/XA:[RASHCNETO] Exclude files with any of the given attributes
/IS Overwrite files even if they are already the same
/IT Include tweaked files
/XJ Exclude junction points from source /XJ
/XJD Exclude junction points from source directories
/XJF Exclude junction points from source files
/MAX:n Exclude files bigger than n bytes
/MIN:n Exclude files smaller than n bytes
/MAXLAD:n Exclude files unused since n
/MINLAD:n Exclude files used since n If n < 1900 then n = n days, else n = YYYYMMDD date
/MIR Mirror a directory tree /PURGE /E
/PURGE Delete dest files/folders that no longer exist in source
/XL Exclude files present in source but not destination
/SECFIX Robocopy /secfix fixes file security on all files, even skipped files. Specify the type of security information you want to copy by also using one of these options: /COPYALL /COPY:O /COPY:S /COPY:U /SEC
/ZB Use restartable mode; if access denied use Backup mode

Monitoring Options

Switch Explanation Default Behavior Equivalent Switch Notes
/R:n Number of retries on failed copies /R:1000000 Always try to set this option. I recommend setting this to 10-20 to not waste time retrying.
/W:n Wait time between retries /W:30 Always try to set this option to a lower number to retry more quickly. I suggest 5-10.
/REG Save /R:n and /W:n in the Windows registry as default settings
/RH:hhmm-hhmm times when new copies can be started
/TBD Wait for sharenames to be defined retry error 67
/PF Check run hours on a per file (not per pass) basis
/MON:n Run again when more than n changes seen
/MOT:m Run again in m minutes, if changed

Source: The Ultimate Guide to Robocopy