Robocopy mirror deleted files: recovery methods that can work
By Daniel Brooks Published 10 min read
On this page (9 sections)
- The short version
- How robocopy mirror deletes files
- Do these things immediately after an accidental mirror
- Why deleted files can sometimes return
- Check copies before using recovery software
- Use Windows File Recovery with care
- Avoid mistakes during recovery
- Choose switches that match your backup goal
- Questions people still ask
In short: Files removed by robocopy /MIR can sometimes be recovered. Act quickly, stop writes to the affected drive, check backups and Previous Versions, then consider a recovery tool or drive image.
Part of our guide on recover google drive files after trash
A wrong /MIR command can remove a destination folder's extra files in one run. Your next actions affect what remains recoverable.
| Deleting switch | /PURGE, also included by /MIR |
|---|---|
| Recycle Bin used? | Not in normal command-line robocopy mode |
| Main recovery risk | New writes can reuse deleted data space |
| Immediate action | Stop writes and isolate the affected drive |
| Built-in recovery tool | Windows File Recovery, or winfr |
| Safer copy switch | /E when destination extras should remain |
The short version
- /MIR combines /E and /PURGE, so /PURGE removes destination files missing from the source
- /PURGE, /MIR, /MOV, and /MOVE can remove files, but their targets differ
- Stop writes to the affected drive before scanning or installing recovery software
- Check backups, cloud recovery pages, and Previous Versions before attempting a disk scan
- Use /E instead of /MIR when extra destination files must remain
How robocopy mirror deletes files
Robocopy's /MIR switch makes the destination match the source folder tree. Files and folders missing from the source become extra destination items.
Microsoft documents /MIR as equivalent to /E plus /PURGE. The /E part copies subdirectories, including empty ones, while /PURGE removes destination items absent from the source.
A wrong or empty source path can therefore make a valid destination look full of extras. Robocopy can remove those items without an interactive confirmation prompt.
In normal command-line mode, robocopy deletions are direct filesystem deletions rather than normal Recycle Bin moves. Recycle Bin behaviour can differ with other tools, locations, or custom software. Before you commit to anything, it is worth looking at keeping files intact during migration.
The exact switches matter. /MIR and /PURGE target extra items on the destination, while /MOV and /MOVE remove source items after successful copying.
- /PURGE removes destination files and folders missing from the source
- /MIR combines /E with /PURGE and mirrors the source tree
- /MOV copies files, then removes those source files after successful copying
- /MOVE copies files and directories, then removes the source files and directories after successful copying
- /E copies files and subdirectories, including empty directories, but does not delete destination extras
- /S copies subdirectories except empty ones and does not delete destination extras
Do these things immediately after an accidental mirror
Stop every write to the affected destination. Pause sync tools, downloads, scheduled jobs, and antivirus tasks that might change the same volume.
If it is an external drive, unmount it through Windows or unplug it after pending activity stops. Keep the drive disconnected until you choose a recovery path. If that sounds like your situation, read up on can i get deleted files back next.
A drive image gives you a working copy for repeated scans. Create it on a different disk with a suitable imaging tool if the missing files matter.
Check a verified backup, cloud recovery page, and Previous Versions before scanning. Those routes avoid changing the affected volume.
- Stop writes to the destination drive and pause scheduled robocopy or sync jobs
- Unmount or unplug the affected external drive after pending activity stops
- Create a sector-by-sector image on a different disk when the data matters
- Check backups, cloud recovery pages, and Previous Versions before scanning
- Recover files to a different drive, never back onto the source volume
Why deleted files can sometimes return
On an NTFS volume, deletion usually changes filesystem metadata and marks clusters available for reuse. The file's content can remain in those clusters until later writes replace it. For the detail, see our notes on cloud backup vs cloud storage.
That description is not a promise. NTFS metadata can be reused quickly, and a running system can write logs, updates, caches, or temporary files without obvious action from you.
SSDs add another factor. Windows can send TRIM notifications for released blocks, and the drive may later clear those blocks during internal garbage collection. Microsoft explains TRIM and storage behaviour through its Windows storage documentation: https://learn.microsoft.com/windows-server/administration/windows-commands/fsutil-behavior.
TRIM timing depends on the SSD, firmware, connection, operating system, and workload. A hard disk can also lose recoverability through overwriting, but it does not use SSD flash-block cleanup in the same way. If that sounds like your situation, read up on Duplicati backup keeps failing after large file added next.
If the drive is an SSD with TRIM active, a scan can find little or nothing even soon after deletion. An image made before further use gives a recovery professional the safest working copy, but it cannot restore blocks already cleared.
Check copies before using recovery software
Start with the original source folder, another computer, an external backup, and any versioned backup system. A good copy is safer and faster than reconstructing files from raw storage.
Cloud services often keep deleted items for weeks, but retention varies by provider, account, administrator settings, and current policy. Open the provider's web recovery page and check its current rules for OneDrive, Dropbox, or Google Drive. We go through program to find and delete duplicate files step by step elsewhere on the site.
Windows Previous Versions can show snapshots created through File History, System Protection, or another configured backup service. Right-click the affected folder, choose Properties, and open Previous Versions.
A missing tab or empty list means Windows found no usable snapshot for that folder. It does not prove the files never existed elsewhere.
Check email attachments, project exports, chat uploads, and older USB drives too. Ten minutes spent finding a copy can save hours of scanning.
- Check the original source and any second computer for an intact copy
- Open the cloud provider's web recovery page and follow its current retention policy
- Right-click the affected folder and inspect Properties, then Previous Versions
- Restore from a dated snapshot or backup to a separate destination
- Verify the restored files before changing the robocopy job
| Source | What controls availability | Effort |
|---|---|---|
| OneDrive, Dropbox, or Google Drive recovery page | Provider policy, account type, and administrator settings | Open the web interface |
| Windows Previous Versions | File History, System Protection, or another snapshot source enabled beforehand | Right-click the folder |
| External backup drive | Backup schedule and whether old versions remain | Connect only when safe |
| Other computer or shared folder | Whether a separate copy was retained | Search the known path |
Use Windows File Recovery with care
Windows File Recovery, named winfr, is Microsoft's command-line recovery tool. Microsoft distributes it through the Microsoft Store and documents its modes, syntax, and limitations here: https://support.microsoft.com/windows/recover-lost-files-on-windows-61f5b28a-f5b8-3cc8-7c6f-7d7b0d4f3d6e.
Its correct command depends on the Windows version, source filesystem, recovery mode, file type, and path. The destination must be a different drive from the source.
A simplified example looks like this: winfr C: D: /regular /n \Users\Name\Documents\*.docx. Here, C: is the source, D: is a separate destination, /regular selects one recovery mode, and /n limits the search pattern.
Treat that line as an annotated example, not a universal command. Read Microsoft's current documentation, select the mode it recommends for your filesystem, and replace the drive letters and path with your own values.
Install or run recovery software from another volume when possible. Save recovered files to another physical drive, not a different folder on the affected volume.
Recuva and PhotoRec are other options, but their interfaces and scan methods differ. If the files are irreplaceable, stop after imaging and consult a recovery specialist rather than testing several tools on the original disk.
| Tool or route | Interface | Best use |
|---|---|---|
| Windows File Recovery | Command line | Microsoft-documented recovery attempt with a separate destination |
| Recuva | Graphical | Common files and simpler guided scans |
| PhotoRec | Menu-based | Raw recovery when filesystem records are damaged |
| Professional recovery service | Specialist equipment | High-value data, failing drives, or SSD cases |
Avoid mistakes during recovery
A second robocopy command cannot undo a deletion. It can copy back a verified source copy, or remove more destination data if its paths are wrong.
Recovery software does not guarantee complete results. A file may be incomplete when its clusters were reused, its metadata was damaged, or an SSD cleared its blocks through TRIM.
Do not install recovery software or save recovered files on the affected volume. Use a separate drive, and work from an image when the files have high value.
A dry run helps prevent the next accident. Add /L to a future robocopy command, inspect the proposed actions, then remove /L only after checking the full source and destination paths.
For example, robocopy "C:\Data" "D:\Backup" /MIR /L lists planned work without performing the copy or deletion. Test the command with harmless folders before using real data.
Check scheduled tasks too. A task using an old source path can repeat the problem after the immediate recovery work ends.
- Use /L to preview a robocopy job before it changes files
- Use full source and destination paths instead of relying on the current directory
- Test destructive jobs with disposable folders
- Pause scheduled robocopy tasks until their paths and switches are verified
- Keep recovered files on a separate drive
Choose switches that match your backup goal
Use /E when you want a one-way copy that leaves extra destination files in place. /S has the same non-deleting behaviour for non-empty subdirectories, but it excludes empty directories.
Use /PURGE when you intentionally want destination items absent from the source removed. It can be used with other copy options and is also included by /MIR.
Use /MIR when the destination must match the source tree, including removal of destination extras. It is convenient for replication, not historical backup.
Use /MOV when files should leave the source after successful copying. Use /MOVE when files and directories should leave the source after successful copying. Check Microsoft's command documentation for conditions and exceptions.
Microsoft's robocopy switch reference is here: https://learn.microsoft.com/windows-server/administration/windows-commands/robocopy. The page defines switch syntax and behaviour, so consult it before scripting a job.
A mirror is not a versioned backup. Pair routine copying with File History, snapshots, or a backup system that preserves older versions.
- Replace /MIR with /E when destination extras must remain
- Run any remaining /MIR or /PURGE job with /L first
- Use full paths and quote paths containing spaces
- Keep a versioned backup separate from the mirror destination
- Review scheduled tasks after moving or renaming source folders
Recovery is possible in some cases, especially when a backup or snapshot exists. Isolate the drive, check copies, and use an imaged source with a separate recovery destination when the data matters.
Questions people still ask
Does robocopy /MIR use the Recycle Bin?
In normal command-line mode, robocopy removes matching destination extras through filesystem operations rather than placing them in the normal Recycle Bin. Other tools or unusual storage locations can behave differently.
Which robocopy switches can remove data?
/PURGE removes destination files and directories absent from the source. /MIR includes /PURGE. /MOV removes source files after successful copying, while /MOVE removes source files and directories after successful copying. /E and /S copy without deleting destination extras.
Can I undo a robocopy mirror?
Robocopy has no general undo command. Restore from a verified backup, cloud recovery page, Previous Versions, or a recovery image, then copy the restored data back carefully.
Is /E safer than /MIR?
For a destination that must retain extra files, yes. /E copies the source tree without removing destination extras. It does not provide version history by itself.
Why did SSD recovery fail?
NTFS can mark deleted clusters available, but later writes can reuse them. TRIM and SSD garbage collection can clear released flash blocks, so recovery depends on the drive, firmware, operating system, timing, and later activity.