Example usage for robocopy.
robocopy C:\data D:\backup /E /R:2 /W:2Copy directory trees with retry, mirroring and metadata options; mirroring can remove destination files.
robocopy <source> <destination> [<file>[ ...]] [<options>]The linked Microsoft Learn article is the upstream authority. Availability may depend on Windows release, role, optional feature or interactive tool context.
Example usage for robocopy.
robocopy C:\data D:\backup /E /R:2 /W:2Example from the linked Microsoft Learn article. Check its paths, targets and availability before adapting it.
robocopy c:\reports "\\marketing\videos" yearly-report.mov /mt /zExample from the linked Microsoft Learn article. Check its paths, targets and availability before adapting it.
robocopy C:\Users\Admin\Records D:\Backup /E /ZB /LOG:C:\Logs\Backup.logExample from the linked Microsoft Learn article. Check its paths, targets and availability before adapting it.
robocopy C:\Users\Admin\Records D:\Backup /MIR /R:2 /W:5 /LOG:C:\Logs\Backup.logExample from the linked Microsoft Learn article. Check its paths, targets and availability before adapting it.
robocopy C:\Users\Admin\Records D:\Backup /S /MAXAGE:7 /MOV /LOG:C:\Logs\Backup.logExample from the linked Microsoft Learn article. Check its paths, targets and availability before adapting it.
robocopy C:\Users\Admin\Records D:\Backup /ETA /PURGE /LOG:C:\Logs\Backup.logExample from the linked Microsoft Learn article. Check its paths, targets and availability before adapting it.
robocopy C:\Users\Admin\Records D:\Backup /S /E /COPY:DAT /MT:16 /LOG:C:\Logs\Backup.log| Option / clause | Description |
|---|---|
/S, /E | Copy subdirectories; /E includes empty directories. |
/MIR | Mirror a tree; may delete destination files absent from the source. |
/COPY:<flags> | Choose file properties to copy, such as data, attributes and timestamps. |
/R:<n>, /W:<n> | Set retry count and wait time after a failed copy. |
/L | List planned actions without copying or deleting files. |
/MT[:n] | Use multiple threads where supported. |
/lev:<n> | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/z | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/b | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/zb | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/j | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/efsraw | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/copy:<copyflags> | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/dcopy:<copyflags> | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/sec | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/copyall | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/nocopy | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/secfix | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/timfix | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/a-:[RASHCNETO] | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/create | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/fat | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/256 | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/mon:<n> | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/mot:<m> | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/rh:hhmm-hhmm | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/pf | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/ipg:<n> | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/sj | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/sl | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/sparse:<y | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/noclone | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/iomaxsize:<n>[kmg] | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/iorate:<n>[kmg] | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/threshold:<n>[kmg] | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/xa:[RASHCNETO] | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/xf <filename>[ ...] | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/xd <directory>[ ...] | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/xc | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/maxage:<n> | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/minage:<n> | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/maxlad:<n> | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/minlad:<n> | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/xj | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/fft | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/reg | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/tbd | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/x | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/v | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/ts | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/fp | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/bytes | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/ns | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/nc | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/nfl | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/ndl | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/np | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/eta | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/log:<logfile> | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/log+:<logfile> | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/unilog:<logfile> | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/unilog+:<logfile> | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/tee | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/njh | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/njs | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/unicode | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/job:<jobname> | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/save:<jobname> | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/quit | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/purge | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/mov | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/move | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/a+:[RASHCNET] | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/nodcopy | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/nooffload | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/compress | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/sparse:<y|n> | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/a | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/m | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/ia:[RASHCNETO] | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/xn | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/xo | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/xx | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/xl | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/dst | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/xjd | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/xjf | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/nosd | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/nodd | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
/if | Microsoft documents this switch; use the linked reference for accepted values, effects and version limits. |
<source> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<destination> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<file> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<options> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.