bool DeleteDirectory(const CString& strDirName) { CFileFind tempFind; TCHAR sTempFileFind[200]; _tcscpy(sTempFileFind, strDirName); _tcscat(sTempFileFind, L"\*.*"); BOOL IsFinded = tempFind.FindFile(sTempFileFind); while (IsFinded) { IsFinded = tempFind.FindNextFile(); TCHAR sFoundFileName[200]; _tcscpy(sFoundFileName, tempFind.GetFilePath()); DeleteFile(sFoundFileName); } tempFind.Close(); if (!RemoveDirectory(strDirName)) { return FALSE; } return TRUE; }