#include "stdafx.h"
bool DeleteDirectory(char* DirName)
{
CFileFind tempFind;
char tempFileFind[200] ;
sprintf(tempFileFind,"%s\\*.*",DirName);
BOOL IsFinded = tempFind.FindFile(tempFileFind);
while (IsFinded)
{
IsFinded = tempFind.FindNextFile();
if (!tempFind.IsDots())
{
char foundFileName[200];
strcpy(foundFileName,tempFind.GetFileName().GetBuffer(200));
if (tempFind.IsDirectory())
{
char tempDir[200];
sprintf(tempDir,"%s\\%s",DirName,foundFileName);
DeleteDirectory(tempDir);
}
else
{
char tempFileName[200];
sprintf(tempFileName,"%s\\%s",DirName,foundFileName);
DeleteFile(tempFileName);
}
}
}
tempFind.Close();
if(!RemoveDirectory(DirName))
{
MessageBox(0,"é?3y꧰ü","꧰ü",MB_OK);
return FALSE;
}
return TRUE;
}
void main()
{
DeleteDirectory("d:\\222");
}