robocopy: Copying and Backing Up Files from Command Prompt

Intermediate Command Prompt Fixes Applies to: Windows 7, Windows 10, Windows 11

A far more reliable alternative to drag-and-drop for copying large numbers of files, with the ability to resume interrupted copies.

Before you start: save any open work and note down what you were doing when the problem started — that context helps if you need to search further or ask for help.
  1. Basic syntax is robocopy "source folder" "destination folder" — always wrap paths with spaces in quotation marks.
  2. Add /e to include all subfolders, even empty ones, which is usually what you want when backing up an entire folder structure.
  3. Add /z to enable restartable mode, so an interrupted copy (network drop, accidental cancel) can resume from where it left off rather than starting over.
  4. Add /mir to mirror the destination exactly to match the source, including deleting files in the destination that no longer exist in the source — use this carefully, since it can delete files at the destination.
  5. Robocopy's exit codes look alarming but usually aren't — a small number after "Return Code" is normal and doesn't mean the copy failed; only codes 8 and above indicate a real problem.
Still not fixed? Send us the details and we'll help you dig further, or browse related guides in Command Prompt Fixes.

Frequently Asked Questions

How is robocopy different from just dragging and dropping files?
Robocopy can resume interrupted transfers, preserve file permissions and timestamps, retry on network errors automatically, and handle very large file sets more reliably than manual copying — genuinely useful for big or unreliable transfers.
Will robocopy overwrite files at the destination?
By default it copies over files with the same name, but it has options to skip existing files or only copy newer versions — worth checking the specific flags before running it on a destination with data you want to keep.

Related guides