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.
/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
- Source:
C:\Users\YourName\Documents - Destination:
D:\ExternalBackup\Documents - Log:
C:\Users\YourName\robocopy-backup.log
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
| Option | Purpose |
|---|---|
/E | Copies subfolders, including empty ones, without purging extra destination files |
/COPY:DAT | Copies file data, attributes, and timestamps |
/DCOPY:DAT | Copies directory data, attributes, and timestamps where supported |
/Z | Uses restartable mode for interrupted copies |
/R:2 /W:5 | Limits retries to two with a five-second wait |
/XJ | Excludes junction points to reduce recursive path surprises |
/TEE | Shows 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
- Create a small source folder with sample documents.
- Run the preview and then the real copy.
- Open files directly from the destination.
- Copy one destination file to a separate restore folder and open it there.
- 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
- It does not keep historical versions of every changed file.
- It does not protect a destination that remains connected during ransomware or accidental bulk changes.
- It does not prove every copied file is readable unless you verify it.
- It does not preserve every NTFS permission or audit property with the selected
/COPY:DAToptions. - It should not be the only copy of irreplaceable data.
Completion checklist
- The preview showed the intended source and destination.
- The return code and log contain no unreviewed failures.
- The destination count and sample files are correct.
- A restore copy opens successfully.
- At least one additional backup is separate from the actively connected computer when the data is important.
Official Microsoft reference
Related Guides
- How to Find Duplicate Files with PowerShell and Export a Report — Create a duplicate-file report before cleaning an archive.
- How to Access Your Office PC Remotely with Tailscale — Set up private remote access without exposing a Windows PC directly to the internet.
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.