#include <windows.h>
#define ISDOTS(psz) ((psz)[0] == '.' && ((psz)[1] == '\0' || (psz)[1] == '.' && (psz)[2] == '\0'))
BOOL DeleteDirectory(LPCTSTR pszDir)
{
TCHAR szDirOld[MAX_PATH];
HANDLE hFind;
WIN32_FIND_DATA find;
GetCurrentDirectory(MAX_PATH, szDirOld);
if (!SetCurrentDirectory(pszDir))
return FALSE;
hFind = FindFirstFile(TEXT("*"), &find);
if (hFind != INVALID_HANDLE_VALUE)
{
do
{
if (ISDOTS(find.cFileName))
continue;
if (find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
DeleteDirectory(find.cFileName);
}