Sign in to follow this  
AndiDog

Can't delete folder with spaces

Recommended Posts

AndiDog    145
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 ???

Share this post


Link to post
Share on other sites
AndiDog    145
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).

Share this post


Link to post
Share on other sites
Aardvajk    13207
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?

Share this post


Link to post
Share on other sites
dave    2187
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

Share this post


Link to post
Share on other sites
AndiDog    145
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this