# Robocopy ## Metadata **Created**:: [[2024-04-05]] **Host**:: [[learn.microsoft.com]] **Source**:: #from/clipper **Status**:: #x **Title**:: Robocopy **URL**:: [learn.microsoft.com](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy) **Zettel**:: #zettel/literature **Topic**:: [[♯ Windows]] ## Synopsis Copies file data from one location to another. ## Syntax ``` robocopy <source> <destination> [<file>[ ...]] [<options>] ``` ## Options ### Scenarios #### Backup Back up files recursively. Copy file existing in the destination when size is different. ``` Robocopy.exe src dest /e /mt /z ``` - `/e`: include subdirectories and empty directories - `/mt`: multi-threads - `/z`: restartable The default behavior without `/im` is copying file when timestamp or size does not match. #### Back Up Modified Copy files existing in the destination only when the size does not match. ``` Robocopy.exe src dest /e /mt /z /im ``` - `/im`: only include files with different file sizes. #### Back Up Non-Existing Copy only files absent in the destination. ``` Robocopy.exe src dest /e /mt /z /xc /xn /xo ``` - `/xc`: eXclude Changed files. - `/XN`: eXclude Newer files. - `/XO` eXclude Older files. #### Mirror Delete the files only in the destination. ``` Robocopy.exe src dest /mir /mt /z /im ``` - `/mir` = `/e /purge` - `/purge`: delete dest files/dirs that no longer exist in source. #### Move Delete src after copying ``` Robocopy.exe src dest /e /move /mt /z ``` - `/move`: move files and dirs ### Logging - `/eta`: estimated finish time - `/log:out.log`: save to the log file `out.log` - `/tee`: show progress in console and log file ### Job - `/save:name`: save to the file `name.rcj` - `/job:name`: load from the file `name.rcj`