Robocopy is a native Windows tool for syncing files and folders. This guide is aimed at (ex-) Linux/Mac users who want a native Windows solution to syncing/mirroring folders like Rsync.

Keep in mind that Robocopy is not a feature-by-feature replacement for Rsync and does NOT natively support syncing over SSH. It does, however allow syncing with Network Shares (SMB/CIFS).

Table of Contents:

Basic folder syncing

To start, open a PowerShell window.

Robocopy commands are structured like:

robocopy <source> <destination> [<options>]

To sync a folder in your Home directory to an external drive (H:) :

robocopy ~\Documents H:\backups\Documents /s

This syncs the folder "Documents" in ~, which is your user's home directory (C:\Users\yourUsername by default) with H:\backups\Documents. The /s option tells Robocopy to copy subdirectories when available. This however does not sync empty directories.

If you also want empty subdirectories to be synced, use /e :

robocopy ~\Documents H:\backups\Documents /e

To copy all file information (time stamps, owner information etc), use the /copy:datso option ( Data, Attributes, Timestamps, Security, Owner info):

robocopy ~\Documents H:\backups\Documents /copy:datso /e

Mirroring

To mirror a folder, use the /mir option. This will delete destination files and directories that do not exist in the source :

robocopy ~\Documents H:\backups\Documents /mir

Other useful options

Resources