ROBOCOPY for Windows

ROBOCOPY is a command-line file replication utility. The name robocopy is a concatenation of “Robust Copy”, a fitting description, as it exceeds the capabilities of the built-in Windows copy and xcopy commands, and is designed to be very efficient at mirroring files and directories.


robocopy <Source> <Destination> [<File>[ ...]] [<Options>]

Robocopy Copy Options

/Scopy Subdirectories, but not empty ones.
/Ecopy subdirectories, including Empty ones.
/LEV:nonly copy the top n LEVels of the source directory tree.
/Zcopy files in restartable mode.
/Bcopy files in Backup mode.
/ZBuse restartable mode; if access denied use Backup mode.
/Jcopy using unbuffered I/O (recommended for large files).
/EFSRAWcopy all encrypted files in EFS RAW mode.
/COPY:copyflag[s]what to COPY for files (default is /COPY:DAT).
(copyflags : D=Data, A=Attributes, T=Timestamps).
(S=Security=NTFS ACLs, O=Owner info, U=aUditing info).
/SECcopy files with SECurity (equivalent to /COPY:DATS).
/COPYALLCOPY ALL file info (equivalent to /COPY:DATSOU).
/NOCOPYCOPY NO file info (useful with /PURGE).
/SECFIXFIX file SECurity on all files, even skipped files.
/TIMFIXFIX file TIMes on all files, even skipped files.
/PURGEdelete dest files/dirs that no longer exist in source.
/MIRMIRror a directory tree (equivalent to /E plus /PURGE).
/MOVMOVe files (delete from source after copying).
/MOVEMOVE files AND dirs (delete from source after copying).
/A+:[RASHCNET]add the given Attributes to copied files.
/A-:[RASHCNET]remove the given Attributes from copied files.
/CREATECREATE directory tree and zero-length files only.
/FATcreate destination files using 8.3 FAT file names only.
/256turn off very long path (> 256 characters) support.
/MON:nMONitor source; run again when more than n changes seen.
/MOT:mMOnitor source; run again in m minutes Time, if changed.
/RH:hhmm-hhmmRun Hours – times when new copies may be started.
/PFcheck run hours on a Per File (not per pass) basis.
/IPG:nInter-Packet Gap (ms), to free bandwidth on slow lines.
/SLcopy symbolic links versus the target.
/MT[:n]Do multi-threaded copies with n threads (default 8).
n must be at least 1 and not greater than 128.
This option is incompatible with the /IPG and /EFSRAW options.
Redirect output using /LOG option for better performance.
/DCOPY:copyflag[s]what to COPY for directories (default is /DCOPY:DA).
(copyflags : D=Data, A=Attributes, T=Timestamps).
/NODCOPYCOPY NO directory info (by default /DCOPY:DA is done).
/NOOFFLOADcopy files without using the Windows Copy Offload mechanism.

Note: Using /PURGE or /MIR on the root directory of the volume will cause robocopy to apply the requested operation on files inside the System Volume Information directory as well. If this is not intended then the /XD switch may be used to instruct robocopy to skip that directory.

File Selection Options

/Acopy only files with the Archive attribute set.
/Mcopy only files with the Archive attribute and reset it.
/IA:[RASHCNETO]Include only files with any of the given Attributes set.
/XA:[RASHCNETO]eXclude files with any of the given Attributes set.
/XF file [file]…eXclude Files matching given names/paths/wildcards.
/XD dirs [dirs]…eXclude Directories matching given names/paths.
/XCeXclude Changed files.
/XNeXclude Newer files.
/XOeXclude Older files.
/XXeXclude eXtra files and directories.
/XLeXclude Lonely files and directories.
/ISInclude Same files.
/ITInclude Tweaked files.
/MAX:nMAXimum file size – exclude files bigger than n bytes.
/MIN:nMINimum file size – exclude files smaller than n bytes.
/MAXAGE:nMAXimum file AGE – exclude files older than n days/date.
/MINAGE:nMINimum file AGE – exclude files newer than n days/date.
/MAXLAD:nMAXimum Last Access Date – exclude files unused since n.
/MINLAD:nMINimum Last Access Date – exclude files used since n.
(If n < 1900 then n = n days, else n = YYYYMMDD date).
/XJeXclude Junction points. (normally included by default).
/FFTassume FAT File Times (2-second granularity).
/DSTcompensate for one-hour DST time differences.
/XJDeXclude Junction points for Directories.
/XJFeXclude Junction points for Files.

Robocopy Retry Switches

/R:nnumber of Retries on failed copies: default 1 million.
/W:nWait time between retries: default is 30 seconds.
/REGSave /R:n and /W:n in the Registry as default settings.
/TBDwait for sharenames To Be Defined (retry error 67).

Robocopy Log Options

/LList only – don’t copy, timestamp or delete any files.
/Xreport all eXtra files, not just those selected.
/Vproduce Verbose output, showing skipped files.
/TSinclude source file Time Stamps in the output.
/FPinclude Full Pathname of files in the output.
/BYTESPrint sizes as bytes.
/NSNo Size – don’t log file sizes.
/NCNo Class – don’t log file classes.
/NFLNo File List – don’t log file names.
/NDLNo Directory List – don’t log directory names.
/NPNo Progress – don’t display percentage copied.
/ETAshow Estimated Time of Arrival of copied files.
/LOG:fileoutput status to LOG file (overwrite existing log).
/LOG+:fileoutput status to LOG file (append to existing log).
/UNILOG:fileoutput status to LOG file as UNICODE (overwrite existing log).
/UNILOG+:fileoutput status to LOG file as UNICODE (append to existing log).
/TEEoutput to console window, as well as the log file.
/NJHNo Job Header.
/NJSNo Job Summary.
/UNICODEoutput status as UNICODE.

Robocopy Job Options

/JOB:jobnametake parameters from the named JOB file.
/SAVE:jobnameSAVE parameters to the named job file
/QUITQUIT after processing command line (to view parameters).
/NOSDNO Source Directory is specified.
/NODDNO Destination Directory is specified.
/IFInclude the following Files.

Add a Comment

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