debugger? u meant thatthing tat show error when u compile stuff? There's no errors.
Your I dea was pretty good but there was 1 small problem, Instead of going upwards in dir tree it went backwards
-------------- Build: Debug in testdll ---------------
Linking dynamic library: bin\Debug\testdll.dll
Creating library file: bin\Debug\libtestdll.a
Output size is 1.26 MB
Process terminated with status 0 (0 minutes, 1 seconds)
0 errors, 0 warnings
I executed ths dll func in D:\My Documents\cpp\dll\testdll\bin\Debug\New folder
and it deleted all files in.
- New folder
- My Documents
I lost all files from my documents :S I even don't know if I had there something valueable but it didn't delete the dirs.
But bigger problem is that
D:\My Documents\cpp\dll\testdll\bin\Debug\New folder\test\New folder (2)\ still contains it's files. how to fix that?
That's the code.
I don't know it I think in right direction but I think I need method to skip action if path ends with . or .. but I have no idea how to do that.
void DLL_EXPORT DeleteAllFiles(const LPCSTR folderPath)
//MessageBoxA(0, folderPath, "DLL Message", MB_OK | MB_ICONINFORMATION);
sprintf(fileFound, "%s\\*.*", folderPath);
hp = FindFirstFile(fileFound, &info);
//what if there are no files found???
sprintf(fileFound,"%s\\%s", folderPath, info.cFileName);
//is this a folder?
//use the dwFileAttributes to find the folders
//if it is a folder, call DeleteAllFiles(fileFound)
if ( FindFileData.dwFileAttributes )
//MessageBoxA(0, fileFound, "Folder dedected", MB_OK | MB_ICONINFORMATION);
edit after few secs DLL crashed (i think it happened when it tried to clear D:\
D:\ contains my data, there's no system prodected files, dno why it didn't totch it ..