I used to back up my project folder by dragging it from one drive to another and going to make coffee. Windows Explorer would show me a progress bar, estimate three hours remaining, then crash at 80% because one file was locked. Then I'd start over and hope.

robocopy fixed that. It's a command-line copy tool that's been built into Windows since the Vista days — honestly, since the NT era. It's what a lot of commercial backup software quietly wraps around. And nobody tells you it exists.

Here's what it actually does, and how I use it.

The basic command

text

robocopy "C:\Users\You\Documents" "D:\Backup\Documents" /E

That copies the entire Documents folder — including all subfolders, including empty ones — to your backup drive. The /E flag means "everything, including empty directories." Without it, empty folders get skipped.

Note the quotes. If any path has a space in it, robocopy will misread the command without them.

Why it's faster than dragging files

Explorer copies one file at a time and gives up on locked files. Robocopy copies multiple files in parallel (32 streams by default) and doesn't care about Explorer's progress dialog. On a folder with thousands of small files, the difference is not subtle. It's the difference between 40 minutes and 4.

The flags I actually use

The bare /E flag is fine, but this is my standard command:

text

robocopy "C:\Source" "D:\Backup" /E /Z /R:2 /W:2 /LOG:"D:\backup-log.txt" /TEE

Let me break down what each one does, because it matters:

  • /E — copy all subdirectories, including empty ones
  • /Z — restartable mode. If the copy gets interrupted, it picks up where it left off instead of starting over. Slow on small files, so drop it if you have thousands of them.
  • /R:2 — retry a failed file twice, then move on. The default is one million retries, which is why robocopy sometimes appears to hang forever on a single locked file.
  • /W:2 — wait 2 seconds between retries. Default is 30 seconds.
  • /LOG:"D:\backup-log.txt" — write the full output to a log file. You want this. Trust me.
  • /TEE — also show the log in the window while running.

Mirroring (the risky but useful flag)

If you want the backup to be an exact mirror of the source — deleting files in the backup that no longer exist in the source — add /MIR:

text

robocopy "C:\Source" "D:\Backup" /MIR /R:2 /W:2

Use this carefully. /MIR deletes files in the destination that aren't in the source. If you point it at the wrong folder, it will wipe it. I've only ever used it for syncing one drive to another, never for a "backup" in the traditional sense — because a proper backup should keep old versions, not mirror the current state.

If you want to keep files that were deleted from the source (the actual safe way to back up), drop /MIR and stick with /E. The backup just grows over time.

Preview before you commit

The single most useful flag nobody mentions is /L. It stands for "list only" — robocopy tells you exactly what it would do, without touching a single file:

text

robocopy "C:\Source" "D:\Backup" /E /L

Run this first whenever you're trying a new command with new flags. It has saved me from /MIR disasters more than once.

Scheduling it

You can schedule robocopy with Windows Task Scheduler the same way you'd schedule anything else — point it at a .bat file with the command inside and set a daily or weekly trigger. I have one running every Sunday at 2 AM, pointed at my project folders.

If you'd rather do it in Python, your backup article on this site already covers that — robocopy and that script solve the same problem, just from different directions.

Honest limitations

  • No versioning. Robocopy mirrors or copies — it doesn't keep old copies of files. If you overwrite a file and back it up, the old version is gone.
  • No cloud. It's a file-to-file copy. If your backup drive fails at the same time as your PC, you have nothing. Always keep one copy off-site.
  • The default retry setting is genuinely terrible. One million retries at 30-second intervals means a single locked file can stall the whole copy for the better part of a year. Always set /R and /W.

Why I use it

It's the fastest, most reliable way I know to get files from one disk to another on Windows — and it's been sitting there the whole time, in the same Command Prompt I use to check my RAM usage. Same tool, different flag.

If you're serious about backups, pair this with the Python script on this site: use the script for daily versioned snapshots, use robocopy for the big copy jobs. Between them, you'll never drag a folder again.