How to Create a Safer One-Way Backup with Robocopy

Robocopy is included with Windows and can make a repeatable one-way copy to another folder, drive, or network location. For a cautious first setup, preview with /L, avoid /MIR, keep a log, and test that you can open files from the destination. A copy job is not the same as versioned or offline backup protection.

Do not begin with mirror mode: /MIR can remove destination items that no longer exist in the source. Use it only when that deletion behavior is intentional, tested, and backed up.

Choose a source and a dedicated destination

Confirm the external drive letter and free space. Do not point the destination inside the source tree.

Preview the job without copying

robocopy "C:\Users\YourName\Documents" "D:\ExternalBackup\Documents" /E /COPY:DAT /DCOPY:DAT /R:2 /W:5 /XJ /L /TEE

/L lists the proposed actions. Review the source, destination, unexpected subfolders, and file count. Remove /L only after the preview matches your intention.

Use a one-way copy script with a log

@echo off
set "SOURCE=C:\Users\YourName\Documents"
set "DEST=D:\ExternalBackup\Documents"
set "LOG=C:\Users\YourName\robocopy-backup.log"

robocopy "%SOURCE%" "%DEST%" /E /COPY:DAT /DCOPY:DAT /Z /R:2 /W:5 /XJ /TEE /LOG+:"%LOG%"
set "RC=%ERRORLEVEL%"

if %RC% GEQ 8 (
  echo Robocopy reported at least one failure. Review: %LOG%
) else (
  echo Robocopy finished with return code %RC%. Review the log and destination.
)
pause

What the options mean

OptionPurpose
/ECopies subfolders, including empty ones, without purging extra destination files
/COPY:DATCopies file data, attributes, and timestamps
/DCOPY:DATCopies directory data, attributes, and timestamps where supported
/ZUses restartable mode for interrupted copies
/R:2 /W:5Limits retries to two with a five-second wait
/XJExcludes junction points to reduce recursive path surprises
/TEEShows output in the console as well as the log
/LOG+Appends to the existing log

Read the return code correctly

Robocopy uses nonzero codes for several successful or informational outcomes. Microsoft documents that codes below 8 can represent copied files, extra destination files, or mismatches without a copy failure. A value of 8 or greater means at least one failure occurred. Always read the log rather than treating every nonzero code as identical.

Run a restore test, not only a copy test

  1. Create a small source folder with sample documents.
  2. Run the preview and then the real copy.
  3. Open files directly from the destination.
  4. Copy one destination file to a separate restore folder and open it there.
  5. Delete one sample from the source, run again, and confirm the destination copy remains with this non-mirror command.

Schedule only after the manual job is stable

In Task Scheduler, create a task that starts the batch file. The destination must be connected and use the expected drive letter. For network storage, the scheduled account must have access when the task runs. Review the task’s last-run result and the Robocopy log after the first scheduled execution.

Know what this job does not protect

Completion checklist

Official Microsoft reference

Related Guides

About the author

Tweaknook Editorial publishes practical guides and browser-based tools for everyday digital work. Product-dependent facts are checked against current primary documentation, with limitations and safer verification steps stated where relevant.