Robocopy: Commands, Switches, and Usage Examples
Robocopy's full switch list is long, but a manageable set covers the vast majority of real-world copy, backup, and mirror jobs. Here's what they do, ready-to-use example commands, and where the sharp edges are.
Updated September 8, 2026 · PC Utility Hub Editorial Team
What robocopy is
Robocopy (Robust File Copy) is a command-line file-copy utility built into Windows, designed for reliably copying or mirroring large numbers of files and folders, including over unreliable network links. It's included in Windows 10 and Windows 11 by default — no download or install is required, and it works the same way in Command Prompt or PowerShell.
Basic syntax
Source and destination are folder paths, not file paths — robocopy always operates on directories (optionally with a file mask). Run from an elevated Command Prompt or PowerShell if copying system or permission-protected folders.
robocopy <source> <destination> [files] [options]
robocopy C:\Data D:\Backup /E
robocopy C:\Data D:\Backup /MIR /Z /R:2 /W:5 /MT:16 /LOG:C:\Logs\backup.logSwitch reference
| Switch | Effect |
|---|---|
| /E | Copies subdirectories, including empty ones. |
| /S | Copies subdirectories, but skips empty ones (unlike /E). |
| /MIR | Mirrors the destination to match the source exactly, including deleting files/folders in the destination that no longer exist in the source. |
| /Z | Copies files in restartable mode, so an interrupted large file resumes instead of restarting from scratch. |
| /J | Copies using unbuffered I/O, which can speed up copying very large files. |
| /COPY:DAT | Sets what's copied per file: Data, Attributes, Timestamps (the default copy flags). |
| /COPYALL | Copies all file information: data, attributes, timestamps, owner, permissions (ACLs), and audit data. |
| /DCOPY:T | Copies directory timestamps as well as file timestamps (default only copies directory data, not its timestamp). |
| /XO | Excludes older files — skips overwriting a destination file if it's newer than or the same age as the source version. |
| /XD dirs | Excludes the specified directories (by name or path) from the copy. |
| /XF files | Excludes the specified files (by name or wildcard) from the copy. |
| /R:n | Sets the number of retries on a failed copy (default is a very high 1,000,000 — always set this explicitly). |
| /W:n | Sets the wait time in seconds between retries (default 30 seconds — usually too long for routine jobs). |
| /MT:n | Copies files multi-threaded with n threads (default 8 when used without a number), which speeds up jobs with many small files. |
| /LOG:path | Writes a full log to the given file, overwriting it; use /LOG+:path to append instead. |
| /TEE | Displays log output in the console window in addition to writing it to the log file. |
| /L | List-only mode — reports what would be copied, overwritten, or deleted without changing anything. |
| /NP | Suppresses the per-file progress percentage, producing a shorter, more readable log. |
| /PURGE | Deletes destination files/folders that no longer exist in the source, without also copying new/changed files the way /MIR does (rarely used alone). |
The /MIR warning: it deletes files
Warning: /MIR makes the destination an exact mirror of the source. Any file or folder present in the destination but not in the source will be deleted, and deletions are permanent — not sent to the Recycle Bin. Test with /L (list-only, no changes) first, and double-check source and destination are the right way around before running /MIR for real.
Example: mirror a folder
Makes D:\Backups\Projects an exact copy of C:\Projects, deleting anything in the backup that's no longer in the source.
robocopy C:\Projects D:\Backups\Projects /MIR /R:2 /W:5Example: dry run before mirroring
Reports exactly what a real /MIR run would copy or delete, without touching any files — always run this once against a new source/destination pair before the real /MIR command.
robocopy C:\Projects D:\Backups\Projects /MIR /LExample: resume a large interrupted transfer
/Z lets a large file that was interrupted mid-copy resume from where it left off rather than restarting; /R and /W control retry behavior for a flaky drive or network path.
robocopy E:\Video F:\Archive\Video /E /Z /R:5 /W:10Example: copy with permissions and ownership
/COPYALL preserves NTFS permissions, ownership, and audit data along with the file data — useful when migrating a shared folder to new storage and permissions must carry over exactly.
robocopy C:\Shared D:\Shared_Copy /E /COPYALL /R:2 /W:5Example: exclude folders and files
/XD skips entire named directories anywhere under the source; /XF skips matching files by name or wildcard — useful for excluding build artifacts, caches, or temp files from a backup.
robocopy C:\Data D:\Backup /E /XD node_modules .git temp /XF *.tmp *.logExample: logging a job
/LOG+ appends to an existing log file instead of overwriting it, /NP keeps the log readable by dropping per-file progress percentages, and /TEE mirrors the same output to the console.
robocopy C:\Data D:\Backup /MIR /LOG+:C:\Logs\backup.log /NP /TEEExample: a scheduled backup command
This is a typical pattern for a Task Scheduler job: mirror the folder, use multithreading and restartable mode for speed and resilience, fail fast on locked files with low retry/wait values, and append to a running log for later review.
robocopy C:\Users\Me\Documents D:\Backups\Documents /MIR /Z /MT:16 /R:2 /W:5 /LOG+:C:\Logs\daily-backup.logRealistic retry and wait settings
Robocopy's defaults (1,000,000 retries at 30 seconds each) exist for unattended jobs over flaky network links, but on a local job a locked file will otherwise appear to hang for a very long time. For interactive use, /R:2 /W:5 fails fast and moves on, and you can always re-run for anything skipped.
Windows 10 and Windows 11 availability
robocopy.exe ships with both Windows 10 and Windows 11 as a native command-line tool — there's no separate download, and the switches behave identically across both versions. Neither version includes a built-in graphical front-end for it.
Robocopy vs a GUI or TeraCopy
Robocopy is the right tool for scripted, scheduled, and mirror-style jobs where you control both ends precisely. For a one-off graphical copy with visual progress and checksum verification, TeraCopy or Explorer's native copy is simpler, and a GUI wrapper can make the switches easier to remember day to day.
For a full side-by-side comparison of workflow, verification, and automation, see TeraCopy vs Robocopy.
If you'd rather not memorize switches
Several third-party graphical front-ends build robocopy commands for you from a form, which can help while you're still learning the switches.
See our roundup of Robocopy GUI options.
Frequently asked questions
- Does /MIR delete files permanently?
- Yes — files removed by /MIR go straight to deletion, not the Recycle Bin, unless you add a separate mechanism. Always test with /L first.
- What's the difference between /MIR and /E?
- /E copies all subfolders including empty ones but never deletes anything in the destination. /MIR does the same copying but also deletes destination files/folders absent from the source.
- What's the difference between /E and /S?
- /E copies subdirectories including empty ones; /S copies subdirectories but skips empty ones.
- How many threads should I use with /MT?
- /MT:8 (the implied default) works for most cases; going higher (/MT:16 or /MT:32) can help with many small files on fast storage but can also saturate a network link — test on your actual hardware.
- Why did robocopy report 'skipped' for some files?
- By default robocopy skips files that already appear identical (same size and timestamp) at the destination — that's expected behavior, not an error.
- Is robocopy available on Windows 11?
- Yes, robocopy.exe is built into Windows 11 (and Windows 10) with no separate install required.
- How do I copy files with their NTFS permissions intact?
- Use /COPYALL to copy data, attributes, timestamps, owner, permissions, and audit data together, or /COPY:DAT plus additional flags for finer control.
Related pages
- Robocopy GUIClarifies that Robocopy is CLI-only and surveys GUI front-ends, including the discontinued RichCopy.
- TeraCopy vs RobocopyA side-by-side look at TeraCopy and Robocopy to help pick the right tool for a given copy job.
- TeraCopyOverview of TeraCopy's copy/verify features, editions, and official download source.
- DiskpartOverview of the diskpart cmd tool and its core disk and partition commands.
- Diskpart Clean & Format USBCommands to safely wipe and reformat a USB flash drive with diskpart.