Sign in to follow this  

deleting folders and contents

This topic is 4837 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

im trying to delete a folder and its contents: using _chdir to change the directory, and rmdir to remove the directory(once i have emptied the files in it). What i do is to find all files/folders i na directory, delete the files, then go into the folder and do the same thing recursively, this deletes the files perfectly well, but when i try to delete the folders, windows wont let me, i get an error saying the directory is in use, now i have determined if i dont go into the folder with _chdir and then go back out to delete the folder, windows doesnt like it, is there some way i have to release handles i get to folders via _chdir? has any one had this problem and found a solution?

Share this post


Link to post
Share on other sites
use DOS commands with the system() function. it accepts a string as it's arguement so you'd want to compile the filename into a string then parse it through system(), i think it only accepts c style char array strings though so use the member function c_str() or wahtever it is to convert it. if useing the stl string class;

Share this post


Link to post
Share on other sites
i use _findfirst, i was wondering if i had to release the handles... and yep, thats the problem had to release handles with
_findclose

thx guys

[Edited by - supagu on September 12, 2004 11:27:50 PM]

Share this post


Link to post
Share on other sites

This topic is 4837 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