Of course. Robocopy (Robust File Copy) is an incredibly powerful command-line tool built into Windows, far superior to the basic copy
or xcopy
commands. It’s designed for reliable, resilient copying of large file sets and directory trees.

Here is a comprehensive guide to more Robocopy options and practical examples.
Core Syntax
robocopy <source> <destination> [<file>[ ...]] [<options>]
Key Advanced Options & Flags
Here are some of the most useful advanced options, categorized by function.
1. Copy Options & Data Integrity
- /Z – Copies files in restartable mode. If the connection is lost, Robocopy can pick up where it left off instead of restarting the file from the beginning. Essential for large files over unstable networks.
- /ZB – Uses restartable mode. If file access is denied, it switches to Backup mode. This tries to use the Windows Backup privilege to override file permissions. Very useful for copying files owned by another user or system files.
- /J – Copies using unbuffered I/O (recommended for very large files). It bypasses the system cache, which can improve performance on large files.
- /SL – Copy symbolic links instead of the target files/directories.
- /DCOPY:T – Copy Directory Timestamps correctly. Helps preserve the original folder creation/modified times.
2. File Selection & Filtering
- /XF [ …] – eXclude Files. Excludes files matching given names or wildcards (e.g.,
*.tmp
,desktop.ini
). - /XD [ …] – eXclude Directories. Excludes entire directories (e.g.,
\Windows
,$RECYCLE.BIN
). - /IM – Include Modified files. By default, Robocopy won’t copy a file if the source and destination have the same name and timestamp, even if the file content has changed. This flag forces it to copy if the file is newer, even if the timestamp matches (rare). Use with caution.
- /MAX:n – MAXimum file size – exclude files larger than
n
bytes. - /MIN:n – MINimum file size – exclude files smaller than
n
bytes. - /A – Copy only files with the Archive attribute set.
- /M – Copy only files with the Archive attribute set and then reset (turn off) the attribute. This is how backup systems track what has been copied.
3. Retry and Logging
- /R:n – Number of Retries on failed copies. Default is 1,000,000! Always set this to a sane number like
/R:3
or/R:5
. - /W:n – Wait time between retries, in seconds. Default is 30 seconds. Use something like
/W:5
. - /TEE – Output to the console window and to the log file.
- /NP – No Progress. Suppresses displaying the progress percentage for each file. Makes the log much cleaner.
- /LOG: – Output status to a LOG file (overwrites the existing log).
- /LOG+: – Output status to a log file (appends to the existing log).
4. Advanced Mirroring & Purge (Use with Extreme Caution!)
- /MIR – MIRror a directory tree. This is equivalent to
/E /PURGE
./E
– Copies subdirectories, including Empty ones.- /PURGE – Deletes files and directories from the destination that no longer exist in the source. This is a destructive operation. Double-check your paths before using /MIR or /PURGE.
- /L – List-only mode. Shows what would be copied/deleted but doesn’t actually do anything. CRITICAL for testing commands with /PURGE or /MIR.
5. Performance & Multithreading
- /MT:n – Creates multi-threaded copies with n threads (1 to 128). Default is 8 (
/MT:8
). Great for copying many small files across a high-latency network (e.g.,/MT:32
). Using too many threads on a disk with slow seek times (like a HDD) can hurt performance.
Practical Examples
1. Basic Mirror with Logging and Safety
Goal: Sync D:\Data
to F:\Backup
, deleting anything in the backup that’s not in the source. Safe because we test first.
REM # First, do a trial run with /L to see what will happen
robocopy "D:\Data" "F:\Backup" /MIR /L /NP /LOG:C:\RobocopyLog.txt
REM # If the log looks correct, run it for real
robocopy "D:\Data" "F:\Backup" /MIR /Z /R:3 /W:5 /NP /TEE /LOG+:C:\RobocopyLog.txt
2. Copy Only New/Changed Files (Incremental Backup)
Goal: Copy only files that have the Archive bit set (i.e., new or modified files) and then reset the bit.
robocopy "C:\Projects" "G:\Backup\Projects" /E /M /Z /R:3 /W:5 /NP /LOG+:C:\BackupLog.txt
3. Selective Copy – Exclude Junk Files
Goal: Copy a user’s Documents
folder but exclude temporary files, node_modules
(huge), and hidden AppData
-like directories.
robocopy "C:\Users\Alice\Documents" "Z:\Archive\Alice_Docs" /E /Z /XF ~*.* *.tmp /XD node_modules .git AppData /R:2 /W:3 /LOG:C:\CopyLog.txt
4. Network Copy with Multithreading and Restartable Mode
Goal: Copy a large software repository from a network share to a local SSD quickly and resiliently.
robocopy "\\Server\Repository" "D:\LocalRepo" /E /MT:32 /Z /R:5 /W:10 /TEE /LOG:D:\CopyLog.log
5. Preserve All Attributes & Permissions (Admin Command Prompt)
Goal: Make a perfect 1:1 copy of a directory, including all security permissions (owner, ACLs), timestamps, and attributes. Run CMD as Administrator.
robocopy "D:\Source" "E:\Clone" /E /COPYALL /DCOPY:T /MT:8 /Z /R:3 /W:5 /LOG:C:\CloneLog.txt
- /COPYALL is equivalent to
/COPY:DATSOU
(Data, Attributes, Timestamps, Security, Owner, Audit info).
6. Simple “What’s New” Command
Goal: Quickly see what files exist in the source that are newer than the destination, without copying anything.
robocopy "D:\Photos" "F:\Photos_Backup" /L /S /XN /XC /NP
- /L: List only, no copy.
- /S: Copy non-empty subdirs.
- /XN: eXclude Newer files (so only show source files that are older or the same).
- /XC: eXclude Changed files (so only show source files that are exactly the same). Combined with
/XN
, this shows only files that are older in the source, which is usually nothing. Removing these flags shows what’s newer.
Pro Tip: Create a Batch File for Common Tasks
Save a complex command as a .bat
file (e.g., MyBackup.bat
) so you can run it easily.
@echo off
echo Starting Backup: %date% %time% >> C:\BackupLog.txt
robocopy "D:\Important" "F:\Backup" /MIR /Z /R:3 /W:5 /TEE /LOG+:C:\BackupLog.txt
echo Backup Finished: %date% %time% >> C:\BackupLog.txt
Final Warning: Always test commands, especially those with /MIR
or /PURGE
, using the /L
(list) flag first to see exactly what will be copied and, more importantly, deleted.
Author is a passionate Blogger and Writer at Dlightdaily . Dlightdaily produces self researched quality and well explained content regarding HowToGuide, Technology and Management Tips&Tricks.