I am trying to create a robust recursive delete folder function.
It works very well in normal directories.
The problem occurs when I create a "hardcore", for example:
C: \ test \ x \ x \ x \ x \ x \ x \ x \ x \ x \ x \ x \ x \ x \ x \ x \ x \ x \ x \ x \ x \ x \ ... \ x \ x \ x
The length of this order is about 25,000 (less than the MSDN limit: 32,767). I basically created this directory recursively until the CreatDirectory function exited.
Now the strangest thing is that my function is able to delete 2 directories, and FindFirstFile with 0x5:
\\?\C:\test\x\ ... \x\x\x\*.* < no error \\?\C:\test\x\ ... \x\x\*.* < no error \\?\C:\test\x\ ... \x\*.* < access denied
(I can restart it, the application slowly iterates over the folder, 2 by 2, probably until the path length becomes quite small)
I run FindFirstFile to check if the folder is empty.
- Are there any restrictions that are less documented?
- FindFirstFile just not working? (Is it buggy?)
- Am I missing some kind of NTFS permission?
- Something else...
EDIT: IMPORTANT NOTE: If I run the program step by step slowly ... then nothing will work.
source share