Jump to content
  • Advertisement
Sign in to follow this  
supagu

deleting folders and contents

This topic is 5003 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
Advertisement
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
If you're using FindFirstFile/FindNextFile, make sure you actually close the find handle by using FindClose. The open find handle will keep the directory in use.

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!