Delete a Path-Too-Long Folder Using robocopy
Mirror an empty folder over the stubborn directory to wipe it out when Explorer refuses.
01Command
$ mkdir C:\EmptyDir && robocopy C:\EmptyDir "C:\Very\Long\Nested\Path\Folder" /MIR && rmdir /s /q C:\EmptyDir02What 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
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- robocopyEvidence: Documents the /MIR switch (mirror a directory tree, deleting destination items not in the source) and handles long paths.
- Robocopy — Robust file copyEvidence: 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
Diagnose NTFS file system errors and bad sectors on any volume — including the system drive while Windows is running — before committing to a repair.
Robocopy is Windows' built-in robust file copier: use /MIR to keep a destination folder as an exact one-way mirror of a source, resumable and restartable.
Two-step command sequence that makes you the owner of a locked file tree and grants yourself full control — the standard fix for 'Access is denied' on old profiles and OS reinstall leftovers.