SESK: Stuff Everyone Should Know · sesk.info/aplus-robocopy-mirror
Which robocopy switch mirrors a directory tree, copying files and purging extras at the destination?
/mir mirrors a directory tree, equal to /e plus /purge.
- /mir ✔
- /lev:1
- /s
Why: A mirror makes the destination match the source. That includes deleting files at the destination that no longer exist at the source, so use it carefully.
Huh, didn't know that: robocopy /lev:n copies only the top n levels of the source directory tree.
A programmer's wife says: go to the store and buy a gallon of milk, and if they have eggs, get a dozen. He comes back with 12 gallons of milk.
Like this card?
References
Answer: /mir. A mirror makes the destination match the source. That includes deleting files at the destination that no longer exist at the source, so use it carefully.
- robocopy command reference, Microsoft Learn learn.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy
/mir Mirrors a directory tree (equivalent to /e plus /purge ).
Checked 2026-10-10.
Think this answer is wrong? Tap "Challenge this answer" on the card in the game and tell us why.
More stuff everyone should know
That's stuff everyone should know.