MFC
특정 폴더 파일, 하위 폴더를 삭제하는 함수
leo21c
2016. 6. 1. 16:30
특정 폴더 파일, 하위 폴더를 삭제하는 함수 구현
void etDataBase::RemoveDir(CString strDir, BOOL bOnlyFile/* = false*/)
{
CFileFind finder;
BOOL bWorking = TRUE;
CString strDirFile = strDir + CString("\\*.*");
bWorking = finder.FindFile(strDirFile);
while(bWorking)
{
bWorking = finder.FindNextFile();
if(finder.IsDots()) continue;
if(finder.IsDirectory() && !bOnlyFile) RemoveDir(finder.GetFilePath());
else ::DeleteFile(finder.GetFilePath());
}
finder.Close();
if (!bOnlyFile)
::RemoveDirectory(strDir);
}
위오 같이 처리하면 됨
LIST