2019-05-08 16:11:54 +01:00
|
|
|
# robocopy
|
|
|
|
|
|
|
|
> Robust File and Folder Copy.
|
|
|
|
> By default files will only be copied if the source and destination have different time stamps or different file sizes.
|
2022-10-04 16:06:23 +01:00
|
|
|
> More information: <https://learn.microsoft.com/windows-server/administration/windows-commands/robocopy>.
|
2019-05-08 16:11:54 +01:00
|
|
|
|
2021-01-31 17:05:18 +00:00
|
|
|
- Copy all `.jpg` and `.bmp` files from one directory to another:
|
2019-05-08 16:11:54 +01:00
|
|
|
|
2023-02-20 07:23:49 +00:00
|
|
|
`robocopy {{path\to\source_directory}} {{path\to\destination_directory}} {{*.jpg}} {{*.bmp}}`
|
2019-05-08 16:11:54 +01:00
|
|
|
|
|
|
|
- Copy all files and subdirectories, including empty ones:
|
|
|
|
|
2023-02-20 07:23:49 +00:00
|
|
|
`robocopy {{path\to\source_directory}} {{path\to\destination_directory}} /E`
|
2019-05-08 16:11:54 +01:00
|
|
|
|
|
|
|
- Mirror/Sync a directory, deleting anything not in source and include all attributes and permissions:
|
|
|
|
|
2023-02-20 07:23:49 +00:00
|
|
|
`robocopy {{path\to\source_directory}} {{path\to\destination_directory}} /MIR /COPYALL`
|
2019-05-08 16:11:54 +01:00
|
|
|
|
|
|
|
- Copy all files and subdirectories, excluding source files that are older than destination files:
|
|
|
|
|
2023-02-20 07:23:49 +00:00
|
|
|
`robocopy {{path\to\source_directory}} {{path\to\destination_directory}} /E /XO`
|
2019-05-08 16:11:54 +01:00
|
|
|
|
2021-08-15 18:59:09 +01:00
|
|
|
- List all files 50 MB or larger instead of copying them:
|
2019-05-08 16:11:54 +01:00
|
|
|
|
2023-02-20 07:23:49 +00:00
|
|
|
`robocopy {{path\to\source_directory}} {{path\to\destination_directory}} /MIN:{{52428800}} /L`
|
2019-05-08 16:11:54 +01:00
|
|
|
|
|
|
|
- Allow resuming if network connection is lost and limit retries to 5 and wait time to 15 sec:
|
|
|
|
|
2023-02-20 07:23:49 +00:00
|
|
|
`robocopy {{path\to\source_directory}} {{path\to\destination_directory}} /Z /R:5 /W:15`
|
2019-05-08 16:11:54 +01:00
|
|
|
|
2024-01-30 04:55:24 +00:00
|
|
|
- Display help:
|
2019-05-08 16:11:54 +01:00
|
|
|
|
|
|
|
`robocopy /?`
|