- static void DeleteDirectories(CString csPath)
- {
- CFileFind finder;
- CString tempPath;
- tempPath.Format("%s%s", csPath, "//*.*");
- BOOL bWork = finder.FindFile(tempPath);
- while(bWork)
- {
- bWork = finder.FindNextFile();
- if(!finder.IsDots())
- {
- if(finder.IsDirectory())
- {
- DeleteDirectories(finder.GetFilePath());
- }
- else
- {
- DeleteFile(finder.GetFilePath());
- }
- }
- }
- finder.Close();
- RemoveDirectory(csPath);
- }
引用:https://blog.csdn.net/timothy721/article/details/8860050