Sign in to follow this  

Can't delete folder with spaces

This topic is 4039 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
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
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
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

This topic is 4039 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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