Robocopy is hanging in the corner of your PC, maybe without you ever noticing it. It is a built-in command line for Windows operating systems that allows for quick file transfers from one place to another. On top of that, you can even transfer whole directories or drives.
This is not a commonly used command. It is actually an external command. Robocopy was available in the Windows NT and Windows 2000 resource kits and all the Windows operating systems after Vista (7, 8, and 10).
In this article, you will find all about the useful Robocopy commands and what they do.
Robocopy Parameters and Syntax
robocopy <Source> <Destination> [<File>[ …]] [<Options>]
Source – Points to the source directory path.
Destination – Points to the destination directory path.
File- Shows which files will be copied. Wildcard characters like “*” or “?” can be used.
Options – Shows options usable by a robocopy command.
The following options are added at the end of the command. This also includes file selection, retry, logging, and job options.
/s is for copying subfolders, except the ones that are empty.
/e is for copying subfolders, including those that are empty.
/lev:N is for copying the top N levels in the source folder tree.
/z files are copied in restartable mode.
/b files are copied in Backup mode.
/zb is using restartable mode. In case of access being denied, it will use Backup mode.
/efsraw all encrypted files are copied in EFS RAW mode.
/copy:CopyFlags Tells which file properties to copy. The proper values for this option are: D is data, O is owner info, A is attributes, T is timestamps, U is auditing info, and S stands for Security=NTFS ACLs.
/sec files are copied with security (same as /copy:DATS).
/copyall entire file info is copied (same as /copy:DATSOU).
/nocopy file info is excluded (combines well with /purge).
/secfix all files get file security fix, including skipped ones.
/timfix all files get fixed time, including skipped ones.
/purge deletes destination folders and files which were removed from the source.
/mir mirrors the folder tree (same effect as /e plus /purge).
/mov moves files and deletes them from the source after they are copied.
/move moves and deletes files and directories from the source when they are copied.
/a+:[RASHCNET] gives attributes of source files to copied files.
/a-:[RASHCNET] removes attributes of source files from copied files.
/fat makes destination files by only using 8.3 FAT file names.
/256 Turns off support for paths over 256 characters. /mon:N Does a source monitor. it runs again when it detects more than N changes.
/mot:M Does a source monitor and will run again if it detects changes within a set number of minutes.
/MT[:N] Makes multi-threaded copies with a specified number of threads (default is 8). N has to be between 1 and 128. This feature’s not compatible with /EFSRAW and /IPG parameters. You can redirect output via /LOG option if you want to speed things up.
/rh:hhmm-hhmm Gives info on when you can start new copies.
/pf is checking run hours. Checks aren’t on per pass, but per-file basis.
/ipg:n is there for users with lower bandwidth. It inserts gaps between packets.
File Selection Options
/a only copies files with a set Archive attribute.
/m does same as above. Additionally, it resets the attribute.
/ia:[RASHCNETO] includes just the files which have a specified attribute.
/xa:[RASHCNETO] excludes files with specific attributes.
/xf <FileName>[ …] excludes files which match the given paths, names, or wildcards.
/xd <Directory>[ …] Excludes folders which match the given paths and names.
/xc omits changed files.
/xn omits newer files.
/xo leaves out older files.
/xx leaves out extra folders and files.
/xl leaves out lonely folders and files.
/is is for including the same files.
/it is for Including altered or tweaked files.
/max:<N> sets maximum file size and omits files larger than the specified number of bytes.
/min:<N> sets minimum file size and leaves out files smaller than the specified number of bytes).
/maxage:<N> sets maximum file age and omits files created before a specified date or older than a certain number of days.
/minage:<N> sets minimum file age and omits files created after a specified date, or newer than a specified number of days).
/maxlad:<N> sets maximum last access date, leaving out files not used since the specified date).
/minlad:<N> sets minimum last access date, leaving out files accessed since. However, If N is set below 1900 N shows the day count. Otherwise, N shows a date in the standard YYYYMMDD format.
/xj makes an exclusion of junction points.
/fft estimates FAT file times (approx. two sec.)
/r:N shows the number of failed copy retries, 1 million is the default value.
/w:N shows wait time between two retries, 30 seconds by default.
/reg saves the /w and /r options in the registry as default.
/tbd system is going to wait until share names are defined
/l lists the files, without deleting, timestamping or copying.
/x reports the extra files, not only selected ones.
/v gives verbose output, pointing out skipped files.
/ts source file timestamps are included in the output.
/fp puts full path into the output. Works on files.
/bytes will display sizes in bytes.
/ns file sizes won’t be logged.
/nc file classes won’t be logged.
/nfl file names won’t be logged.
/ndl directory names will not be logged.
/np copyprogress will not be displayed.
/eta if you need estimation when the process will be completed.
/log:<LogFile> status output is saved in the log file, overwriting the current log file.
/job:<JobName> parameters will be taken from the specified job file.
/save:<JobName> parameters will be saved to the specified job file.
/quit quits upon the execution of the command line in order to check the parameters.
/nosd no source directory will be specified.
/nodd no destination directory will be specified.
Believe it or not, this is the end. That was a lot of commands, wasn’t it? Hopefully, they will be useful to you. Share your thought with us about the most useful Robocopy commands in the comments below.