Commands · Command

CommandWindows

robocopy

robocopy source destination [file] [options]

Windows' advanced file-copy utility, built for reliably copying or mirroring large directory trees (with resume, retry, and logging built in) — a big step up from plain copy or xcopy.

// FLAGS

/MIRmirror source to destination, deleting extras in the destination
/Ecopy subdirectories, including empty ones
/Zrestartable mode — resumes interrupted copies
/R:nnumber of retries on a failed copy
/LOGwrite output to a log file

// EXAMPLE

robocopy C:\Data D:\Backup /MIR /LOG:backup.log — makes D:\Backup an exact mirror of C:\Data and logs the operation.

// GOTCHA

/MIR deletes files in the destination that no longer exist in the source — pointed at the wrong folder, it can wipe out data that was never meant to be removed.

// RELATED COMMANDS