A faster approach is to bypass the FindFirstFile...() API and directly to the file system. You can use DeviceIoControl() with the FSCTL_ENUM_USN_DATA element to access the main file table, at least in volumes with NTFS formatting. Using this information, you can directly access records for files / folders, including their attributes, parent information, etc. Yes, it will be more work, but it should also be faster, since you can optimize the code to access only the parts you need.
source share