Robocopy reference for copying, migrations, ACLs, restartability, performance, filters, logs, dry runs and exit-code interpretation.
Core examples
robocopy C:Source D:Destination /ECopies subfolders including empty ones without deleting destination extras.
robocopy C:Source D:Destination /E /LShows what would happen without copying.
robocopy C:Source D:Destination /E /TEE /LOG:C:Logsrobocopy.logTEE writes to console and log.
robocopy C:Source \ServeurPartage /E /Z /R:2 /W:5/Z supports restartability but can affect performance.
Directory selection
Includes empty subdirectories without purging extras.
Alternative when empty directories are not needed.
Example: /XD "System Volume Information" Temp.
Avoids some loops/unwanted junction traversal.
File selection
Accepts names and patterns such as *.tmp.
Useful to exclude very large files in an initial pass.
Check date/age syntax before production.
Useful for archive scopes.
Data, attributes & ACLs
Typical content copy without NTFS security.
Requires sufficient privileges for S/O/U.
Use only when full security preservation is required.
Useful when directory timestamps/attributes must be preserved.
Restartability & errors
Allows restart of interrupted large-file copies.
Set a reasonable value; historical defaults can be very high.
Limits time wasted on persistently locked files.
Performance
Example /MT:16; increases CPU, disk and network load.
Can help with very large files depending on storage.
Legacy throttling approach; validate actual impact.
Small-file count can matter more than total bytes.
Mirror, purge & move
Can delete destination content not present in source.
Always dry-run with /L on sensitive scopes.
Deletes source after copying; destructive action.
Source directories remain.
Logs & exit codes
Prefer a reliable local log path during critical migrations.
Useful for live monitoring and evidence.
These codes represent copy/extra/mismatch combinations, not necessarily failure.
Treat as failure and inspect the log.
Key points
- Before /MIR, /PURGE, /MOVE or /MOV, run a /L dry-run and keep logs.
- /COPYALL and /ZB require appropriate privileges and can alter destination security.
- A Robocopy exit code below 8 is not necessarily failure.
- For migrations, compare file count, total size, ACLs and restored samples.