I'm trying to delete a folder which was probably created by decompressing an archive file which lead to somehow exceed the maximum path length limitation. I already checked with chkdsk the file system and there are zero bad sectors. The security tab in folder properties returns an error. I've tried all popular suggested solutions to delete the folder both from the UI and command prompt and all fail with the same "The system cannot find the file specified" error. Any other solution?
Asked
Active
Viewed 3,848 times
2
3 Answers
2
I finally succeeded in deleting the folder. I found on a forum someone who was facing the same error and he suggested using a bash shell and running the rm -rf command. I have git for windows installed which is also installing a bash shell. I ran rm -rf <foldername> from that shell and it worked. Pay attention to this command as it seems really powerful and it probably bypasses some checks that other commands such as rd or del are enforcing.
noplace
- 135
-
The reason Linux's
rmcommand works whereas other commands outside of PowerShell do not, is because Linux doesn't have a 260 character limit for file paths. – JW0914 Mar 13 '21 at 14:08 -
Seeing what you did, it seems like somehow your MBR got corrupted, leaving you with a ghost folder. It shows up in explorer, but windows can't delete it. CMD's
rd -smay have been able to delete it in this case too. – LPChip Mar 13 '21 at 19:58 -
I agree @LPChip. Folder creation succeeded partially probably due to a max path length violation and while I could see the folder in windows explorer I could not in any way act on it.
rm -rfsomehow bypasses some of the checks the other windows tools enforce and thus was able to brutally delete it. – noplace Mar 15 '21 at 08:14
0
There is a bug in Windows 10 - you have to use absolute path.
rmdir /S /Q "%cd%\folder"
del "\\?\C:\test\1"for example. – HelpingHand Mar 13 '21 at 12:01