how to modify this func so that it would also delete folders?
How to modify this function so that It would also delete all directories (including empty ones) in given directory?
Code:
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);
}