Cheat sheet

Robocopy — memo sheet

Robocopy reference for copying, migrations, ACLs, restartability, performance, filters, logs, dry runs and exit-code interpretation.

⌚ About 3 min read
View my favorites
WindowsIntermediate to advanced8 sections · 32 reference points

Robocopy reference for copying, migrations, ACLs, restartability, performance, filters, logs, dry runs and exit-code interpretation.

Core examples

Recursive copy
robocopy C:Source D:Destination /E

Copies subfolders including empty ones without deleting destination extras.

Dry run
robocopy C:Source D:Destination /E /L

Shows what would happen without copying.

Logging
robocopy C:Source D:Destination /E /TEE /LOG:C:Logsrobocopy.log

TEE writes to console and log.

Restartable network copy
robocopy C:Source \ServeurPartage /E /Z /R:2 /W:5

/Z supports restartability but can affect performance.

Directory selection

/E
Inclut sous-dossiers vides

Includes empty subdirectories without purging extras.

/S
Sous-dossiers non vides

Alternative when empty directories are not needed.

/XD
Exclure dossiers

Example: /XD "System Volume Information" Temp.

/XJ
Exclure jonctions

Avoids some loops/unwanted junction traversal.

File selection

/XF
Exclure fichiers

Accepts names and patterns such as *.tmp.

/MAX
Taille maximale en octets

Useful to exclude very large files in an initial pass.

/MINAGE
Exclure fichiers plus récents qu’un âge/date

Check date/age syntax before production.

/MAXAGE
Exclure fichiers plus anciens qu’un âge/date

Useful for archive scopes.

Data, attributes & ACLs

/COPY:DAT
Data, Attributes, Timestamps

Typical content copy without NTFS security.

/COPY:DATSOU
Data, Attributes, Timestamps, Security, Owner, aUditing

Requires sufficient privileges for S/O/U.

/COPYALL
Équivalent à /COPY:DATSOU

Use only when full security preservation is required.

/DCOPY:DAT
Attributs/temps des dossiers

Useful when directory timestamps/attributes must be preserved.

Restartability & errors

/Z
Mode redémarrable

Allows restart of interrupted large-file copies.

/ZB
Redémarrable puis Backup mode

Backup mode requires privileges and can bypass some ACL restrictions.

/R:n
Namebre de retries

Set a reasonable value; historical defaults can be very high.

/W:n
Attente entre retries

Limits time wasted on persistently locked files.

Performance

/MT:n
Copie multithread

Example /MT:16; increases CPU, disk and network load.

/J
I/O non bufferisée

Can help with very large files depending on storage.

/IPG:n
Inter-packet gap

Legacy throttling approach; validate actual impact.

Migration window
Mesurer débit + IOPS + fichiers/s

Small-file count can matter more than total bytes.

Mirror, purge & move

/MIR
/E + /PURGE

Can delete destination content not present in source.

/PURGE
Supprime les extras destination

Always dry-run with /L on sensitive scopes.

/MOVE
Déplace fichiers et dossiers

Deletes source after copying; destructive action.

/MOV
Déplace uniquement les fichiers

Source directories remain.

Logs & exit codes

/LOG
Écrire un journal

Prefer a reliable local log path during critical migrations.

/TEE
Console + log

Useful for live monitoring and evidence.

0 to 7
Result sans erreur bloquante Robocopy

These codes represent copy/extra/mismatch combinations, not necessarily failure.

>= 8
Au moins une erreur de copie

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.
← All cheat sheets
♡ 0