Robocopy Parameters - www.itnator.net

Robocopy Parameters

introductory remarks

Robocopy with 72 parameters is a very powerful command line program for Windows operating systems. With its help you can perform fast and incremental copy operations or create backups. All Robocopy parameters known to us can be found as overview and list at itnator.net. The list of Robocopy parameters is very large – but of course we try to make it understandable 🙂

Where do I get Robocopy?

The Robocopy tool is integrated into 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, where the status “R2” is required. But I think Server 2003 is already history anyway.

Robocopy Parameters

padrinan / Pixabay

Robocopy Parameter Overview

The syntax in the Robocopy prompt is written as follows:

robocopy parameters

Placeholders are also allowed in the Robocopy syntax.
Robocopy always uses “*.*”, so copies everything if no files or directories are specified.
well &Target can be a folder, an entire drive letter, but also a UNC path (“\yourserveryourshare“).
The Robocopy parameters listed below must be appended after the command
.

Of course you don’t want to use only one Robocopy parameter or one option, but several. That’s not a problem! Simply write all parameters with a space one after the other. Example:

Robocopy Parameter List

parameterDescription of the
/SCopies all subdirectories, except the empty folders.
/ECopies all subdirectories, including the empty folders
/LEV:nCopies only up to a directory depth of “n”. Directories below are not copied.
/ZIf the copy operation is interrupted, this option can be used to continue from the point where the copy operation 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 target directories must be formatted as NTFS format.
D – Data, S – Security (NTFS ACLs), A -Attribute, O – Owner Information, T – Timestamp, U – Information for the Surveillance.
By default, Robocopy only copies with the /COPY:DAT option. Monitoring, security and data owners are usually not copied.
/COPYALLJust copy everything, like /COPY:DATSOU
/NOCOPYNothing is copied.
/SECSame as switch /COPY:DATS. Security information and ACLs are copied.
/MOVSource file is deleted after copying
/MOVEMoves files and their folders
/PURGEDeletes files and folders that no longer exist in the source directory.
/MIRThe entire directory is mirrored, i.e. files that no longer exist are also deleted.
/A+:{R|A|S|H|N|T}Changes file attributes when 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 when copying: R – Read only, S – System, N – Not content indexed, A – Archive, H – Hidden, T – Temporary
/CREATECreates empty directories
/FATChanges the file name, maximum 8 characters before and 3 characters after the dot.
/FFTCopied to disks that are compatible to NTFS, but actually only support FAT file system.
/MON:nCounts the changes in the source folder and starts the copy process after “n” changes. But only after the time determined with /MOT will be.
/MOT:nStart the copy process again after “n” minutes. Of course in combination with /MON possible.
/RH:hhmm-hhmmSpecifies the time in which copying is allowed. Format is specified in 24 hour form and must be entered in the format 0000 to 2359.
/PFThis option is optimal if a running copy operation exceeds the period defined with /RH. This allows the copy operation to be completed more quickly.
/IPG:nHere, after 64 KB “n” milliseconds, the system waits before continuing the copy process.
/IA:{R|A|S|H|C|N|E|T|O}Copies only 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 attribute “Archive” 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 [yourself]Does not copy specified directories. Same functionality as command above.
/XCDoes not copy files that have been “modified” in the source folder. are defined.
/XNDoes not copy files that are defined as “newer” in the source folder.
/XOLike parameter /XN, but excludes files that are declared as “older” in the source folder.
/MAX:nFiles larger than “n” bytes are excluded from the copy operation.
/MIN:nFiles smaller than “n” bytes are excluded from the copy operation.
/MAXAGE:nFiles older than “n” days are excluded from the copy operation. Date can also be specified in YYYYMMDD.
/MINAGE:nFiles younger than “n” days are excluded from the copy operation. Date can also be specified in YYYYMMDD.
/MAXLAD:nExcludes from the copy operation files that were not accessed n days ago.
/MINLAD:nLike the parameter “/MAXLAD”, only after “n” days, i.e. newer files.
/R:nReturns the maximum errors that can be skipped when copying.
/W:n“n” indicates the seconds that will be waited if a copy operation failed to try again.
/REGWrites “/R” and “/W” in the registry as defaults – worth for further Robocopy – copy operations
/LOutputs a list of the files to be edited. Copying is not performed, only simulated.
/TSReturns the timestamp of the source file in the logfile. on
/FPSpecify the complete pathname in the log file.
/NSDoes not display 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 that is 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:jobSaves all parameters in a file that can be read with “/JOB:”.
/QUITIt doesn’t matter, but displays the parameters with the parameter “JOB:”.

I hope I helped you with this Robocopy parameter overview and you can copy back and forth 🙂

Robocopy Backup

Many use the copy tool for backup jobs. We have the possibility to copy the files recursively. If you want to synchronize or copy large directories, you will be pleased about the function that only changed or new files are copied and replaced. So you don’t have to copy the complete directory and you save a lot of time. We have prepared an example for you how to create a backup of a folder with Robocopy.

To create of a backup you have to specify the source folder (“C:source folder“) and the destination directory (“\backupsharebackup“). The /mir switch at the end says that a “mirror” should be created, i.e. the directory should be mirrored. This deletes files that no longer exist in the target directory and only copies new files.

Robocopy Exit Code List

After the copy process Robocopy returns exit codes. These specify the status of the operation. In the following table you can find all common ExitCodes, respectively ErrorCodes.

Exit Code 1

No files have been copied. No errors were found. No files match. The files already exist in the target directory. Therefore, it was skipped during copying. So nothing was done.

Exit Code 2

All files were copied successfully. That means it’s all in the green and no errors have occurred.

Exit Code 3

The target directory contains some additional files that are not present in the source directory. No files have been copied.

Exit Code 4

Some files have been copied. Additional files were present. No errors were found.

Exit Code 5

Some files have been copied. Some files don’t match. No errors were found.

Exit Code 6

Additional files and mismatching files are present. No files were copied and no errors occurred. This means that the files already exist in the target directory.

Exit Code 7

Files were copied, a file conflict was present and additional files were present.

Exit Code 8

Some files were not copied.

Christian Gebhardt
 

sidebar
>