Deleting folders that refuse to be deleted…
Sometimes when you want to delete a folder in windows you get a very useful message “Could not find this item… this is no longer located in …”, (yes, the very item you just tried to delete).
So after a bit of cursing, making sure that you are indeed the admin of this box, praying to the windows gods you realise that maybe Windows Explorer is at fault.
Not to worry you think, you open up a cmd line console and navigate to the parent of the offending folder.
And like a true hacker you type
“rd c:\my\bad\folder”
only to be told once again, “The system cannot find the file specified.”
At this point your realise that the folder has spaces… so you think “no problem, I will quote the folder” and you now type
‘rd “c:\my\bad\folder “‘
with the correct number of spaces in the folder name.
Long story short… you cannot do that.
You cannot rename the folder, (I know you will try anyway, but you can’t)
So you Googled for a solution and here you are…
what you need to do is tell the command line to not trim the folder name and to do that, you have to add “\?\” in front, so now you type
‘rd /s /q “\\?\c:\my\bad\folder “‘
Complete with the extra spaces and so on… (I added the /s and /q flags because you forgot that the directory is not empty)
Recent Comments