Robocopy Parameters
This post is also available in: Español (Spanish) Deutsch (German)
Introduction to Robocopy and its parameters
Robocopy with 72 parameters is a very powerful command line tool for Windows operating systems. With its help you can perform fast and incremental copy operations or create backups with the switch MIR. All known robocopy parameters can be found as an overview and list at itnator.net including the robocopy exit code. The list of Robocopy parameters is very large – but we try to make it understandable. By the way, the MIR switch is one of the most popular ones to create a backup of the files. 🙂
Where can I get Robocopy?
The Robocopy tool is integrated in the Windows operating systems. Microsoft Windows Vista, Windows 7, Windows 8, Windows 8.1 and Windows 10 includes Robocopy in the internal system tools. Robocopy is also available on the Windows servers. Except for Server 2003. Stand “R2” is required. But I think Server 2003 is already history anyway.
Robocopy Parameter Overview
The syntax in the Robocopy command prompt is written as follows:
Robocopy <Quelle> <Ziel><Datei> /<Parameter>
Robocopy verwendet immer “*.*”, also kopiert alles, wenn keine Dateien oder Verzeichnisse angegeben werden.
Quelle & Ziel können ein Ordner, ein ganzer Laufwerksbuchstabe, aber auch ein UNC – Pfad sein (“\\yourserver\yourshare“).
Die Robocopy Parameter, die in der Liste unten stehen, müssen hinter dem Befehl angehängt werden.
Of course you don’t want to use only one Robocopy parameter or option, but several. That’s no problem! Simply write all parameters with a space one after the other. Example:
robocopy "C:\folder*" "D:\newfolder\" /S /Z
Parameters | Description |
/S | Copies all subdirectories except the empty folders |
/E | Copies all subdirectories, including empty folders |
/LEV:n | Copies only up to a directory depth of “n”. Directories further down are not copied. |
/Z | If the copy process is interrupted, this option allows you to resume from the point where the copy was interrupted. |
/B | The files are copied in backup mode. So all files are copied. |
/ZB | The /Z option is tried. If a file fails, Robocopy uses the /M option |
/COPY:copyflags | Copies only the file attributes that are defined. The file system on the source and destination directories must be formatted as NTFS. D – data, S – security (NTFS ACLs), A – attributes, O – owner information, T – timestamps, U – monitoring information. By default Robocopy only copies with the /COPY:DAT option. Surveillance, security and data owners are not normally copied. |
/COPYALL | Just copy everything, like /COPY:DATSOU |
/NOCOPY | Nothing is copied at all |
/SEC | Same as switch /COPY:DATS. Safety information and ACLs are copied. |
/MOV | Source file is deleted after copying |
/MOVE | Moves files and their folders |
/PURGE | Files and folders that no longer exist in the source directory are deleted. |
/MIR | Robocopy MIR, very popular: Complete directory is mirrored, so even files that no longer exist are deleted. |
/A+:{R|A|S|H|N|T} | Changes file attributes during copying: R – Read only, S – System, N – Not content indexed, A – Archive, H – Hidden, T – Temporary |
/A-:{R|A|S|H|N|T} | Deletes file attributes during copying: R – Read only, S – System, N – Not content indexed, A – Archive, H – Hidden, T – Temporary |
/CREATE | Creates empty directories |
/FAT | Changes the file names, maximum 8 characters before and 3 after the period. |
/FFT | Copies to media that are compatible with NTFS, but actually only support FAT file system. |
/MON:n | Counts the changes in the source folder and starts the copy operation after “n” changes. But only after the time specified with /MOT. |
/MOT:n | Restarts the copying process after “n” minutes. Of course in combination with /MON possible. |
/RH:hhmm-hhmm | Specifies the time in which copying is allowed. Format is given in 24 hour form and must be entered in format 0000 to 2359. |
/PF | This option is optimal when a copy operation in progress exceeds the time period defined with /RH. The copying process can be completed more quickly. |
/IPG:n | In this case, after 64 KB “n” milliseconds, the system waits before continuing the copy process. |
/IA:{R|A|S|H|C|N|E|T|O} | Only copies files with the defined attributes: R – Read only, A – Archive, S – System, H – Hidden, C – Compressed, N – Not content indexed, E – Encrypted, T – Temporary, O – Offline |
/XA:{R|A|S|H|C|N|E|T|O} | Does not copy files with the defined attributes: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 that have the “Archive” attribute set. |
/M | Like parameter “/A”, but the attribute “Archive” is reset in the source files. |
/XF file [file] | Does not copy specified files. Several can be written one after the other. You can also work with “*” as placeholder. |
/XD you [dir] | Does not copy specified directories. Functions as command above. |
/XC | Does not copy files that are defined as “modified” in the source folder. |
/XN | Does not copy files that are defined as “newer” in the source folder. |
/XO | Same as parameter /XN, but files declared as “older” in the source folder are excluded. |
/MAX:n | Files that are larger than “n” bytes are excluded from the copy process. |
/MIN:n | Files smaller than “n” bytes are excluded from the copy process. |
/MAXAGE:n | Files older than “n” days are excluded from the copy process. Date can also be specified in YYYYMMDD. |
/MINAGE:n | Files that are less than “n” days old are excluded from the copy process. Date can also be specified in YYYYMMDD. |
/MAXLAD:n | Excludes files from the copy process that were not accessed “n” days ago |
/MINLAD:n | Like the parameter “/MAXLAD”, but after “n” days, i.e. newer files. |
/R:n | Specifies the maximum errors that can be ignored during copying |
/W:n | “n” indicates the seconds that are waited if a copy operation has failed to retry. |
/REG | Writes “/R” and “/W” in the registry as default – worth for further Robocopy – copy operations |
/L | Outputs a list of the files to be processed. Copying is not performed, only simulated. |
/TS | Specifies the timestamp of the source file in the log file |
/FP | Specifies the complete path name in the log file |
/NS | Does not show file and directory size in the log |
/NFL | Only errors are written to the log |
/NP | No progress indicator for small and large files |
/ETA | The duration of the copy operation is displayed |
/LOG:file | Path to the log file to be written |
/LOG+:file | Writes the log to an existing log file |
/TEE | Displays the previously copied files at the command prompt |
/JOB:job | Reads the parameters from a job file |
/SAVE:job | Stores all parameters in a file that can be read with “/JOB:”. |
/QUIT | Never mind, but use the parameter “JOB:” to display the parameters |
I hope I have helped you with this Robocopy parameter overview and you can copy back and forth 🙂