RoboCopy switches 1

So I was busy with the most fabulous copy tool ever – RoboCopy.
I always forget the exact switches, so for reference use here they are:

/S Copies subdirectories (excluding empty ones).
/E Copies all subdirectories (including empty ones).
/LEV:n Copies only the top n levels of the source directory tree.
/Z Copies files in restartable mode (that is, restarts the copy process from the point of failure).
/B Copies files in Backup mode (Backup copies are not restartable, but can copy some files that restartable mode cannot).
/ZB Tries to copy files in restartable mode, but if that fails with an “Access Denied” error, switches automatically to Backup mode.
/COPY:copyflags Copies the file information specified by copyflags, which can be any combination of the following :
D – file Data. S – file Security (NTFS ACLs).
A – file Attributes. O – file Ownership information.
T – file Timestamps. U – file aUditing infomation.
Source and destination volumes must both be NTFS to copy Security, Ownership or Auditing information.
/COPYALL Copies Everything. Equivalent to /COPY:DATSOU.
/NOCOPY Copies Nothing. Can be useful with /PURGE.
/SEC Copies NTFS security information. (Source and destination volumes must both be NTFS). Equivalent to /COPY:DATS.
/MOV Moves files (that is, deletes source files after copying).
/MOVE Moves files and directories (that is, deletes source files and directories after copying).
/PURGE Deletes destination files and directories that no longer exist in the source.
/MIR Mirrors a directory tree (equivalent to running both /E and /PURGE).
/A+:{RASHNT} Sets the specified attributes in copied files.
The following attributes can be set:
R – Read only S – System N – Not content indexed
A – Archive H – Hidden T – Temporary
/A-:{RASHNT} Turns off the specified attributes in copied files.
The following attributes can be turned off:
R – Read only S – System N – Not content indexed
A – Archive H – Hidden T – Temporary
/CREATE Creates a directory tree structure containing zero-length files only (that is, no file data is copied).
/FAT Creates destination files using only 8.3 FAT file names.
/FFT Assume FAT File Times (2-second granularity). Useful for copying to third-party systems that declare a volume to be NTFS but only implement file times with a 2-second granularity.
/MON:n Monitors the source directory for changes, and runs again when n changes have been detected, and the minimum time interval specified by /MOT has elapsed.
/MOT:n Monitors the source directory for changes, and runs again when a further n minutes have elapsed, and the minimum number of changes specified by /MON have been detected.
/RH:hhmm-hhmm Defines the time slot during which starting new copies is allowed. Useful for restricting copies to certain times of the day. Both values must be 24-hour times in the range 0000 to 2359.
/PF Makes more frequent checks to see if starting new copies is allowed (per file rather than per pass). Useful in stopping copy activity more promptly at the end of the run hours time slot.
/IPG:n Inserts a delay of n milliseconds after each 64k chunk of file data is copied. Useful for freeing up bandwidth on slow lines.
/IA:{RASHCNETO} Includes files with the specified attributes.
The following file attributes can be acted upon:
R – Read only A – Archive S – System
H – Hidden C – Compressed N – Not content indexed
E – Encrypted T – Temporary O – Offline
/XA:{RASHCNETO} Excludes files with the specified attributes.
The following file attributes can be acted upon:
R – Read only A – Archive S – System
H – Hidden C – Compressed N – Not content indexed
E – Encrypted T – Temporary O – Offline
/A Copies only files with the archive attribute set.
/M Copies only files with the archive attribute set and then resets (turns off) the archive attribute in the source files.
/XJ Excludes Junction points.
/XF file [file] Excludes files with the specified names, paths, or wildcard characters.
/XD dir [dir] Excludes directories with the specified names, paths, or wildcard characters.
/XC Excludes files tagged as “Changed”.
/XN Excludes files tagged as “Newer”.
/XO Excludes files tagged as “Older”..
/XX Excludes files and directories tagged as “Extra”.
/XL Excludes files and directories tagged as “Lonely”.
/IS Includes files tagged as “Same”.
/IT Includes files tagged as “Tweaked”.
/MAX:n Excludes files larger than n bytes.
/MIN:n Excludes files smaller than n bytes.
/MAXAGE:n Excludes files with a Last Modified Date older than n days or specified date. If n is less than 1900, then n is expressed in days. Otherwise, n is a date expressed as YYYYMMDD.
/MINAGE:n Excludes files with a Last Modified Date newer than n days or specified date. If n is less than 1900, then n is expressed in days. Otherwise, n is a date expressed as YYYYMMDD.
/MAXLAD:n Excludes files with a Last Access Date older than n days or specified date. If n is less than 1900, then n is expressed in days. Otherwise, n is a date expressed as YYYYMMDD.
/MINLAD:n Excludes files with a Last Access Date newer than n days or specified date. If n is less than 1900, then n is expressed in days. Otherwise, n is a date expressed as YYYYMMDD.
/R:n Specifies the number of retries on failed copies. (The default is 1 million.)
/W:n Specifies the wait time between retries. (The default is 30 seconds.)
/REG Saves /R:n and /W:n in the registry as default settings.
/TBD Waits for share names to be defined on a “Network Name Not Found” error.
/L Lists files without copying, deleting, or applying a time stamp to any files.
/X Reports all files tagged as “Extra”(including files not selected).
/V Produces verbose output (including skipped files).
/TS Displays source file timestamps in the output log.
/FP Displays full pathnames of files in the output log.
/NC Suppresses output of Robocopy file classes.
/NS Suppresses output of file and directory sizes.
/NDL Turns off logging of directory names. Full file pathnames (as opposed to simple file names) will be shown if /NDL is used.
/NFL Turns off logging of file names. File names are still shown, however, if file copy errors occur.
/NJH Turns of logging of the job header.
/NJS Turns off logging of the job summary.
/NP Turns off copy progress indicator (% copied).
/ETA Shows estimated time of completion for copied files.
/LOG:file Redirects output to the specified file, overwriting the file if it already exists.
/LOG+:file Redirects output to the specified file, appending it to the file if it already exists.
/TEE Displays output in the console window, in addition to directing it to the log file specified by /LOG or /LOG+.
/JOB:job Reads parameters from the named Job file.
/SAVE:job Writes the current parameter settings to the named Job file.
/QUIT Quits after processing the command line. No files will be copied. Use /QUIT with /JOB to view job file contents.
/NOSD Declares that no source directory is specified. Useful in template Jobs for which the source is provided at run time.
/NODD Declares that no destination directory is specified. Useful in template Jobs for which the destination is provided at run time.
/IF Includes files with the specified names, paths, or wildcard characters. Intended for use in Job files only.
/SD:path Explicity specifies the source directory for the copy. Intended for use in Job files only.
/DD:path Explicitly specifies the destination directory for the copy. Intended for use in Job files only.

One comment on “RoboCopy switches

  1. Pingback: RoboCopy switches « MS Tech BLOG

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.