trevorblackman.dev

Documentation

Windows Backups via Robocopy

A practical Windows-to-Windows backup workflow using Robocopy for mirrored incremental backups.

Traditional manual backups, like copying your user folder through File Explorer, are a poor fit for technical workflows. They tend to hang on locked files, stumble over long paths, and waste time copying large volumes of disposable data such as caches and dependency trees.

For a Windows-to-Windows setup, a better approach is to separate irreplaceable data from regenerative data and use a tool that can handle interrupted transfers and file lock conflicts without constant babysitting.

Robocopy Script Generator I made a tool to help you generate a robocopy script, explore flags, save and share scripts with others. Click Here!.

The Core Strategy

The goal is to back up real user data while skipping content that can be recreated later.

  • Keep documents, configuration files, source code, and other personal files.
  • Skip locked system hives such as NTUSER.DAT that commonly break drag-and-drop copies.
  • Exclude high-volume derived folders like node_modules, build caches, and other temporary output.
  • Use incremental synchronization so only new or changed files are copied after the first run.

For this kind of workload, the best built-in Windows tool is robocopy.

Primary Backup Command

robocopy "C:\Users\UserName" "E:\Backups\User_Backup" /MIR /FFT /Z /XA:H /W:2 /R:2 /COPY:DAT /XD AppData Downloads OneDrive node_modules .cache bin pkg dist

This command creates a mirrored incremental backup from your user profile to an external drive.

Why This Works

  • /MIR mirrors the source to the destination. New and changed files are copied, and files deleted from the source are also removed from the backup.
  • /FFT uses FAT-style timestamp tolerance to avoid unnecessary re-copying caused by minor timestamp differences.
  • /Z enables restartable mode so interrupted transfers can resume instead of restarting from zero.
  • /XA:H excludes hidden files, which helps skip unnecessary locked Windows files at the profile root.
  • /W:2 /R:2 prevents the job from hanging on a locked file by retrying only twice with a short wait.
  • /COPY:DAT copies file data, attributes, and timestamps without bringing over ACLs that can cause access issues on another Windows system.
  • /XD excludes low-value, high-churn directories such as AppData, Downloads, node_modules, and common cache or build folders.

Important Notes

  • Replace UserName with your real Windows username.
  • Replace E: with the drive letter of your backup SSD or external drive.
  • Use a dedicated backup destination when relying on /MIR, because files removed from the source will also be removed from the destination.
  • If you need a dry run before committing, add /L to preview what Robocopy would do without copying or deleting anything.
  1. Close development tools or sync-heavy apps if you want the cleanest possible run.
  2. Start with a dry run by adding /L and review the output.
  3. Run the real backup command.
  4. Periodically check the log file or compare the destination contents.
  5. Repeat the same command for future backups so only changed files are transferred.

This approach is faster, more repeatable, and more resilient than manual copy-and-paste backups, especially on developer machines with large caches and dependency folders.