Why you should use Robocopy, Parameters (And How to Simplify Them)

If you’ve ever needed to perform robust backups or file synchronization in a Windows environment, you’ve likely encountered RoboCopy. It’s the powerful, built-in command-line utility designed for reliable file replication. But its true power lies in its vast array of parameters and switches, which can be daunting to master.
This guide breaks down every key RoboCopy parameter, organized into logical categories with concrete examples. We’ll explore how to unlock its full potential, and at the end, show you how to do it all without memorizing a single command.

Primary Copy Options

These switches define how and what you copy from the source to the destination.

  • /S – Copies subdirectories, but not empty ones.
  • /E – Copies subdirectories, including empty ones. This is one of the most common switches for a full copy.
  • /COPY:[flags] – Specifies which file properties to copy. The flags are: D (Data), A (Attributes), T (Timestamps), S (Security/ACLs), O (Owner info), U (Auditing info). The default is /COPY:DAT. To copy everything, use /COPY:DATSOU.
  • /SEC – A shortcut for /COPY:DATS. Copies files with their security permissions.
  • /MIRMirrors a directory tree. This powerful option makes the destination an exact copy of the source, deleting any files in the destination that no longer exist in the source. It’s equivalent to using /E and /PURGE. Use with caution!
  • /PURGE – Deletes destination files and directories that no longer exist in the source.
  • /MOVMoves files (deletes them from the source after copying).
  • /MOVE – Moves files and directories (deletes them from the source after copying).
  • /Z – Copies files in restartable mode. If the copy is interrupted, RoboCopy can resume where it left off. Ideal for large files over unstable networks.
  • /B – Copies files in Backup mode. Allows copying files that the current user might not have permission to access, provided the user has backup operator rights.

Practical Example: To mirror a data directory to a backup drive, including all properties and permissions: robocopy “C:\Users\Admin\Documents” “E:\Backups\Documents” /MIR /COPY:DATSOU

File Selection Options

These switches allow you to filter which files to include or exclude.

  • /A – Copies only files with the Archive attribute set.
  • /M – Copies only files with the Archive attribute set and then resets it (useful for incremental backups).
  • /XF [file] – Excludes Files matching the given names or paths. Wildcards (*, ?) are accepted.
  • /XD [directory] – Excludes Directories matching the given names or paths.
  • /XC – Excludes “changed” files.
  • /XN – Excludes “newer” files.
  • /XO – Excludes “older” files.
  • /XX – Excludes “extra” files and directories (those present only in the destination).
  • /MAX:[size] – Excludes files larger than the specified size in bytes.
  • /MIN:[size] – Excludes files smaller than the specified size in bytes.
  • /MAXAGE:[days] – Excludes files older than a specified number of days.
  • /MINAGE:[days] – Excludes files newer than a specified number of days.

Practical Example: To copy a project folder but exclude temporary files and the node_modules directory: robocopy “C:\Projects\WebApp” “F:\Archives\WebApp” /E /XF *.tmp *.log /XD node_modules

Retry Options

These parameters control how RoboCopy behaves when it encounters errors, such as a locked file or a network interruption.

  • /R:[n] – Number of Retries on failed copies. The default is 1 million.
  • /W:[n]Wait time in seconds between retries. The default is 30 seconds.
  • /TBD – Wait for sharenames To Be Defined (retry error 67).

Practical Example: To try copying a locked file only 5 times, waiting 10 seconds between each attempt: robocopy “\\ServerA\Shared” “C:\LocalCopy” /R:5 /W:10

Logging Options

Control the output and reporting of the copy operation.

  • /LList only. Simulates the copy and shows what would be done, without actually copying, deleting, or modifying any files. Essential for testing a complex script.
  • /VVerbose output, showing skipped files.
  • /NP – No Progress. Suppresses the percentage-complete display for each file.
  • /LOG:[file] – Writes the status output to a log file (overwriting an existing file).
  • /LOG+:[file] – Writes the status output to a log file (appending to an existing file).
  • /TEE – Outputs to both the console window and the log file.
  • /NJH – No Job Header.
  • /NJS – No Job Summary.

Practical Example: To test a mirror command and save a detailed report of what would happen: robocopy “C:\Source” “D:\Destination” /MIR /L /V /LOG:C:\Logs\TestReport.txt /TEE

Advanced & Job Options

Miscellaneous options for performance and job control.

  • /MT:[n]Multi-Threaded. Performs the copy with ‘n’ threads for significantly improved performance, especially on fast networks. ‘n’ must be between 1 and 128. The default is 8.
  • /J – Copies using unbuffered I/O (recommended for large files).
  • /CREATE – Creates a directory tree and zero-length files only.
  • /FAT – Creates destination files by using 8.3 FAT file names only.
  • /JOB:[jobname] – Runs a job defined by the specified job file.
  • /SAVE:[jobname] – Saves all the current parameters to the specified job file.
  • /QUIT – Quits after processing command line (to view parameters).

Practical Example: To perform a very fast backup using 32 threads: robocopy “C:\VMs” “E:\VM_Backups” /E /MT:32

Conclusion: Immense Power, Steep Curve

As you can see, RoboCopy’s parameters provide granular control over every aspect of the file copy process. But remembering, typing, and combining these switches without error is a significant challenge.

This is precisely why we created RoboCopyGUI. Our software gives you access to all of this power through a simple, intuitive graphical interface. You can build your scripts, save them, schedule them, and be confident they will run perfectly, all without typing a single command.

Ready to simplify your backups?

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.