Delete a Path-Too-Long Folder Using robocopy

Mirror an empty folder over the stubborn directory to wipe it out when Explorer refuses.

WindowsFilessystemrobocopyHigh risk
Create an empty folder and run `robocopy C:\EmptyDir "C:\Very\Long\Path\Folder" /MIR` to empty the long path, then delete the shell.

01Command

Command
$ mkdir C:\EmptyDir && robocopy C:\EmptyDir "C:\Very\Long\Nested\Path\Folder" /MIR && rmdir /s /q C:\EmptyDir

02What it does

Explorer and Remove-Item fail when a path exceeds the classic 260-character limit, but robocopy handles long paths natively. Mirroring an empty source folder with /MIR deletes every file and subfolder under the target, after which a simple rmdir removes the empty shell. The same trick works when only a few files are stuck: mirror the folder you want to keep onto itself-adjacent copy instead.

03Risk

RiskHigh risk
RequirementsBuilt into Windows 10/11; no long-path registry change needed.
!Warning: /MIR deletes everything under the destination that isn't in the source — one wrong path and you lose the wrong folder.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • robocopy
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: Documents the /MIR switch (mirror a directory tree, deleting destination items not in the source) and handles long paths.
  • Robocopy — Robust file copy
    SS64 · technical · 2026-09-17
    Evidence: Describes /MIR as equivalent to /PURGE plus /E — mirroring an empty folder deletes everything under the target path.

Last verified: 2026-09-19 · Category: Files & Folders

06Related solutions