The options and exit codes below come from Microsoft's official robocopy documentation, read on 23 November 2026.
Dragging a huge folder in File Explorer works most of the time. But if one file fails halfway through a copy of a game library, photo archive or AI model folder, it's hard to tell what made it across. Robocopy ("robust file copy") is a command-line tool built into Windows. Microsoft lists it as applying to Windows 10 and Windows 11 as well as Windows Server. It gives you more control: it can retry failed files, resume interrupted copies, skip files that are already up to date and write everything to a log file.
The basic command
Open Terminal or Command Prompt and use this pattern:
robocopy <source> <destination> [<file>] [<options>]
If you don't name any files, robocopy copies everything (*.*). By default it copies only the files in the top-level folder, so you'll almost always add /e to include subfolders.
A sensible starting point for copying a big folder to a new drive looks like this:
robocopy "D:\Photos" "E:\Photos" /e /z /mt:8 /r:3 /w:5 /log:"C:\Logs\photos.log" /tee
Here's what each part does, according to Microsoft:
Option | What it does |
|---|
/e
| Copies subfolders, including empty ones (/s skips empty folders) |
/z
| Restartable mode: if a file copy is interrupted, robocopy can pick up where it left off |
/mt:8
| Multi-threaded copy with 8 threads. You can choose 1 to 128, and 8 is the default if you use /mt on its own |
/r:3
| Retries a failed file 3 times |
/w:5
| Waits 5 seconds between retries |
/log:file
| Writes the output to a log file and overwrites any existing log (/log+: appends) |
/tee
| Shows the output in the window as well as writing it to the log |
The retry options matter more than they look. Microsoft says the default is 1,000,000 retries with a 30-second wait between each one. If a file is locked, a copy without /r and /w can sit there for a very long time.
Step 1: Do a dry run first
Add /l to any command to list what robocopy would do without copying, deleting or changing timestamps. This is the safest way to check your paths, especially before you use the mirror option below:
robocopy "D:\Photos" "E:\Photos" /e /l
Step 2: Run the copy and keep a log
Remove /l and run the real command. Microsoft recommends creating a log file so you can check afterwards that the copy completed properly. It also says that when you use /mt, sending the output to a log with /log gives better performance. Add /np if you don't want per-file progress percentages filling the log.
If the copy is interrupted, for example because a USB drive disconnects, run the same command again. Files that are already identical are skipped, and with /z a partly copied file can resume rather than start again.
Step 3: Skip what you don't need
Two exclusion options keep large copies tidy:
/xf excludes files that match names or wildcards, for example /xf *.tmp.
/xd excludes folders, for example /xd "D:\Photos\Cache".
For repeat copies, /xo skips source files that are older than the copy already in the destination.
Step 4: Mirror a folder (carefully)
/mir mirrors a folder tree. Microsoft describes it as equivalent to /e plus /purge, and /purge deletes files and folders in the destination that no longer exist in the source. That makes /mir useful for keeping a backup copy of a folder in sync. It also means that if you get the source and destination the wrong way round, or point it at the wrong folder, it can delete files. Always do a /l dry run first, and never point /mir at the root of a drive that holds anything else.
One more quirk to know: Microsoft warns that if you copy from the root of a device (such as D:\), the destination folder picks up the "hidden" and "system" attributes. Copy a named folder instead where you can.
Step 5: Read the exit code
When robocopy finishes, it reports an exit code. Unlike most commands, a non-zero code doesn't always mean failure:
Code | Meaning (Microsoft) |
|---|
0 | Nothing copied, because the files already exist in the destination |
1 | All files copied successfully |
2 | Extra files in the destination that aren't in the source; nothing copied |
3 | Some files copied and extra files present; no failures |
8 or higher | At least one file failed to copy |
If you script robocopy in a batch file, treat 8 and above as an error, not anything other than 0.
Copying file permissions
By default robocopy copies file data, attributes and timestamps (/copy:DAT). That's what most home users want when moving files to a new drive. If you're copying between NTFS volumes and need to keep security permissions too, /sec adds NTFS access control lists, and /copyall copies all file information, including owner and auditing details.
When to use something else
Robocopy copies files and folders, not whole drives. To move Windows itself to a new SSD, use a cloning tool (see how to clone an SSD with free tools). For scheduled, versioned backups, a dedicated app is easier to manage; see our best free backup software for Windows and how to back up Windows 11. If you're adding a drive to make room, our guide to adding more storage to your PC covers the hardware side.
Our verdict
Robocopy is already on every Windows 10 and Windows 11 PC, and it's the most dependable built-in way to copy a large folder. Start with /e, /z and a log file, set /r and /w so a locked file can't stall the job for hours, and add /mt, which Microsoft describes as giving higher performance. Do a dry run with /l before anything that deletes, especially /mir and /purge. Afterwards, check the exit code: 0 to 3 means no failures, while 8 or above means at least one file didn't copy.