void
DeleteDirectory(CString strDir)
{
if
(strDir.IsEmpty())
{
RemoveDirectory(strDir);
return
;
}
CFileFind ff;
BOOL
bFound = ff.FindFile(strDir+ _T("
\\*"),0
);
while
(bFound)
{
bFound = ff.FindNextFile();
if
(ff.GetFileName()== _T(
"."
)||ff.GetFileName()== _T(
".."
))
continue
;
SetFileAttributes(ff.GetFilePath(),FILE_ATTRIBUTE_NORMAL);
if
(ff.IsDirectory())
{
DeleteDirectory(ff.GetFilePath());
RemoveDirectory(ff.GetFilePath());
}
else
{
DeleteFile(ff.GetFilePath());
}
}
ff.Close();
RemoveDirectory(strDir);
}