guide · static export
Software

Set Up a Mirrored Folder Backup With robocopy and Task Scheduler

A nightly mirror of one important folder to an external drive, with a log you can read and a restore you have actually tested.

by@guidox updated:10/30/26 time:20 min level:Intermediate tested on:Windows 11 24H2 works on:Windows 10, Windows 11
⚠ Safety notice

A mirrored backup deletes files on the target when they disappear from the source. Test the restore and keep a second offline copy.

TL;DR

One **robocopy /MIR** job per folder, started by a **scheduled task**, with **/LOG** as proof. Mirroring also deletes files on the target - so test the restore before you trust it.

Before you start

Requirements

  • An external or second drive with a letter that does not change
  • Admin rights for the scheduled task
  • The full path of the folder you want to protect
Step by step

Instructions

01

Dry run first

Run robocopy with **/L** so it only lists what it would do. Check the 'would copy' and 'extra' counts before anything touches the drive.

robocopy "C:\sers\ame\ocuments" "D:\ackup\ocuments" /MIR /R:2 /W:5 /L /LOG:"%USERPROFILE%\esktop
obo-dryrun.log"
⚠ warning/MIR deletes anything on the target that is not in the source. Point it at an empty folder the first time.
02

Read the log

The 'extra' lines are what /MIR would delete. If your target also holds something else you want to keep, stop and use /E instead of /MIR.

03

Run it for real

Drop **/L** and run the same command. A first mirror of 100 GB takes as long as the copy takes; later runs only move changes.

robocopy "C:\sers\ame\ocuments" "D:\ackup\ocuments" /MIR /R:2 /W:5 /LOG+:"%USERPROFILE%
obo-documents.log"
tip/R:2 /W:5 keeps a locked file from stalling the job for minutes.
04

Schedule it

Create a task that runs daily, 'whether user is logged on or not', with robocopy.exe as the program and the arguments from step 3. Put the full path in 'Start in'.

Program: robocopy.exe
Arguments: "C:\sers\ame\ocuments" "D:\ackup\ocuments" /MIR /R:2 /W:5 /LOG+:"%USERPROFILE%
obo-documents.log"
Trigger: daily, 20:00
05

Know which exit codes mean success

robocopy returns a bitmask: 0 means nothing to do, 1 to 7 are successes with copies or extras, 8 and above are real failures. A task that is 'green' with code 1 did its job.

0 = nothing to do
1-7 = success (files copied / extras seen)
8+ = failure
⚠ warningScheduled-task success does not mean the copy worked. Read the log or check the code.
06

Test a restore

Copy one file back from the backup and open it. Do it once a month - a backup nobody restored is a hope, not a backup.

tipAdd a second, offline copy for ransomware. A mirrored external drive that is always connected is not protection.
Troubleshooting

Common issues

Access denied on some files

Files open in another app or owned by another account. Close the app; for system folders use /B with admin rights or a VSS-based tool.

The task runs but nothing is copied

The arguments lost their quotes, or 'Start in' is empty. Check the task's last run result and the log file.

The drive letter changed

USB drives get letters in plug order. Assign a fixed letter in Disk Management or mount the drive into an empty folder.

The backup drive fills up

/MIR keeps one copy, not versions. If you need history, mirror into dated folders and delete old ones deliberately.

FAQ

Frequently asked

robocopy or File History?

robocopy for an explicit, readable mirror; File History for automatic versions. They can run side by side.

Is /MIR dangerous?

Only if the target holds other data or you swap source and target. Dry-run it once and keep the log.

How to undo this

Disable or delete the scheduled task and remove the target folder you created. Nothing in the source folder was modified.

Changelog · 1 entry
  1. 2026-10-30
    First version
Interactive version: checklist, feedback, related guides →

Free · no account needed · tracks your progress