| 주어진 경로 하위에 위치한 빈폴더를 모두 찾아내 삭제하는 함수입니다. 수정해야 할부분이 있다면 알려주세요 ^^
BOOL DelEmptyFolder(CString strPath) { CFileFind finder; int nValidCnt = 0; BOOL bWorking = finder.FindFile(strPath + "*.*"); while (bWorking) { bWorking = finder.FindNextFile();
if(finder.IsDots()) continue; else if(finder.IsDirectory()) { if(DelEmptyFolder(finder.GetFilePath()) == TRUE) nValidCnt++; } else nValidCnt++; } if(nValidCnt == 0) { // 폴더 삭제 명령 작성할 위치 cout << "Del: " << (LPCTSTR)strPath << endl; return FALSE; }
return TRUE; } |