Mirror folders with robocopy for exact backups
Robocopy is Windows' built-in robust file copier: use /MIR to keep a destination folder as an exact one-way mirror of a source, resumable and restartable.
01Command
$ robocopy "C:\Data" "E:\Backup\Data" /MIR /R:2 /W:5 /DCOPY:DAT /COPY:DAT02What it does
/MIR equals /E (copy all subfolders including empty ones) plus /PURGE (delete destination files that vanished from the source), making the destination an exact copy. /R:2 /W:5 caps retries at 2 with a 5-second wait so locked files don't hang the job for days, and /COPY:DAT /DCOPY:DAT preserve timestamps and attributes on files and directories. Robocopy is multithreaded with /MT:8 or higher and restartable — rerunning the same command resumes where it left off. Check the exit code table: 0 means nothing copied, 1 means files copied successfully, and 8+ means failures (log them with /LOG:path and /TEE).
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- robocopy | Microsoft LearnEvidence: Microsoft documents robocopy /MIR as mirroring a directory tree, copying all subdirectories including empty ones and deleting destination files no longer present in the source.
- Robocopy - Robust File Copy - Windows CMDEvidence: SS64 documents /COPY:DAT as copying data, attributes and timestamps, and /R and /W as retry count and wait time between retries.
Last verified: 2026-09-17 · Category: Files & Folders
06Related solutions
Use the System File Checker to verify every protected Windows system file against known-good copies and automatically replace the damaged ones.
Use Windows Package Manager to install, search, and upgrade thousands of applications from the community repository in one command.
Diagnose NTFS file system errors and bad sectors on any volume — including the system drive while Windows is running — before committing to a repair.