How to modify this function to telete directories too?

I found following func for my DLL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
void DLL_EXPORT DeleteAllFiles(const LPCSTR folderPath)
{
MessageBoxA(0, folderPath, "DLL Message", MB_OK | MB_ICONINFORMATION);
 char fileFound[256];
 WIN32_FIND_DATA info;
 HANDLE hp;
 sprintf(fileFound, "%s\\*.*", folderPath);
 hp = FindFirstFile(fileFound, &info);
 do
    {
       sprintf(fileFound,"%s\\%s", folderPath, info.cFileName);
       DeleteFile(fileFound);

    }while(FindNextFile(hp, &info));
 FindClose(hp);
}

It deletes all files but now folders, how do I make it delete Directories too?I need function that clears given directory.
I removed a bad question
Last edited on
I removed a bad question
Last edited on
Use Shell apis (SHFO)
Topic archived. No new replies allowed.