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 Parameters
padrinan / Pixabay

Robocopy Parameter Overview

The syntax in the Robocopy command prompt is written as follows:

Robocopy <Quelle> <Ziel><Datei> /<Parameter>

robocopy parameters
Platzhalter sind in der Robocopy Syntax ebenfalls erlaubt.
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
ParametersDescription
/SCopies all subdirectories except the empty folders
/ECopies all subdirectories, including empty folders
/LEV:nCopies only up to a directory depth of “n”. Directories further down are not copied.
/ZIf the copy process is interrupted, this option allows you to resume from the point where the copy was interrupted.
/BThe files are copied in backup mode. So all files are copied.
/ZBThe /Z option is tried. If a file fails, Robocopy uses the /M option
/COPY:copyflagsCopies 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.
/COPYALLJust copy everything, like /COPY:DATSOU
/NOCOPYNothing is copied at all
/SECSame as switch /COPY:DATS. Safety information and ACLs are copied.
/MOVSource file is deleted after copying
/MOVEMoves files and their folders
/PURGEFiles and folders that no longer exist in the source directory are deleted.
/MIRRobocopy 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
/CREATECreates empty directories
/FATChanges the file names, maximum 8 characters before and 3 after the period.
/FFTCopies to media that are compatible with NTFS, but actually only support FAT file system.
/MON:nCounts the changes in the source folder and starts the copy operation after “n” changes. But only after the time specified with /MOT.
/MOT:nRestarts the copying process after “n” minutes. Of course in combination with /MON possible.
/RH:hhmm-hhmmSpecifies the time in which copying is allowed. Format is given in 24 hour form and must be entered in format 0000 to 2359.
/PFThis 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:nIn 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
/ACopies only files that have the “Archive” attribute set.
/MLike 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.
/XCDoes not copy files that are defined as “modified” in the source folder.
/XNDoes not copy files that are defined as “newer” in the source folder.
/XOSame as parameter /XN, but files declared as “older” in the source folder are excluded.
/MAX:nFiles that are larger than “n” bytes are excluded from the copy process.
/MIN:nFiles smaller than “n” bytes are excluded from the copy process.
/MAXAGE:nFiles older than “n” days are excluded from the copy process. Date can also be specified in YYYYMMDD.
/MINAGE:nFiles that are less than “n” days old are excluded from the copy process. Date can also be specified in YYYYMMDD.
/MAXLAD:nExcludes files from the copy process that were not accessed “n” days ago
/MINLAD:nLike the parameter “/MAXLAD”, but after “n” days, i.e. newer files.
/R:nSpecifies 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.
/REGWrites “/R” and “/W” in the registry as default – worth for further Robocopy – copy operations
/LOutputs a list of the files to be processed. Copying is not performed, only simulated.
/TSSpecifies the timestamp of the source file in the log file
/FPSpecifies the complete path name in the log file
/NSDoes not show file and directory size in the log
/NFLOnly errors are written to the log
/NPNo progress indicator for small and large files
/ETAThe duration of the copy operation is displayed
/LOG:filePath to the log file to be written
/LOG+:fileWrites the log to an existing log file
/TEEDisplays the previously copied files at the command prompt
/JOB:jobReads the parameters from a job file
/SAVE:jobStores all parameters in a file that can be read with “/JOB:”.
/QUITNever 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 🙂

Johannes Huber
 

In seiner Freizeit macht Johannes nichts lieber, als für ITnator Beiträge zu schreiben. Input bekommt er hierfür von Problemen in der IT Administration von Servern, Clients und vielen weiteren IT Komponenten.

Click Here to Leave a Comment Below 0 comments