Can't delete folder with spaces

Started by
5 comments, last by AndiDog 17 years, 4 months ago
When creating a folder "foldername " (with spaces at the end!) using the mkdir function, I can't delete it afterwards, not even with rmdir. I think the problem is the C++ runtime library that does not prevent such folders to be created (but I can't make one with my mouse and keyboard ^^). Is there a way (or a tool) to delete it anyway (file system is NTFS) or do I really have to search for a Linux Live-CD ???
Advertisement
is the folder empty?
regards/thallishI don't care if I'm known, I'd rather people know me
Yes, it is empty.

I could imagine just erasing the folder entry on the hard disk, but I don't know much about it (don't wanna risk to crash the disk).
Just a thought, but if you get a command prompt to the directory the directory is in and do

dir /x

that will give you the old DOS name for the directory, which will not have spaces in, like Program Files is progra~1 for example.

You may be able to pass that name as an argument to the rmdir() function and it may work. Not really a long term solution.

I wasn't quite clear - are we talking about a rmdir() C/C++ function or the rmdir DOS command?
Well when you navigate to such directories in cmd you have to do:

cd c:/docume~1

So try something like that, pass the name of the folder by passing the first 6 letters and then ~1, ~2 if you are trying to remove the second of two entries with the same first 6 letters.

Dave
Did you try putting the path in quotes and then deleting it?
Alright, it worked with the 8.3 notation. In the console, I could only navigate into the base directory, but "dir /X" shows the short name.

Then, "rmdir 88888888.333" (replaced with my folder's name) worked fine.

Thanks guys :)



@EasilyConfused: I meant the C++ functions mkdir/rmdir

This topic is closed to new replies.

Advertisement