How to deleted a folder named with spaces

I had a folder on the network named just with a few spaces and I had a heck of difficult time trying to delete it. When I tried to delete it from Windows Explorer, I got message saying that

Cannot delete file: cannot read from the source file or disk

And when I tried to rename, or copy & paste, I got the same message over and over telling me the same thing. I definitely had no idea how the folder managed to have a name only with spaces, and was totally stuck today when I really needed to get rid of it in order to get a new program to properly index the server.

I can’t delete it either from the Dos Prompt screen with the command line RD because it wouldn’t recognize a folder named with spaces. Space has its own meanings in command line.

The trick is that I had to find the abbreviated 8.3 format name of the space named folder first and use that name to remove the folder. And this simple command did this trick for me.

dir /x

Because this folder is located in a folder that has thoughts of other folders, I had to export the full list to a text file and was able to track down the 8.3 name of it.

dir /x > folders.txt

image

Aha…the abbreviate 8.3 name of this space named folder is called 8383~1. After I emptied the folder, a simple RD finally made this tough guy go away.

RD 8383~1 

The folder looks much nicer without it.

Leave a Reply

Your email address will not be published. Required fields are marked *