deleting folders and contents
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?
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;
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement