I want to scan FAT32 disk (I just need file path and file name) as soon as possible in C++, Scan every files on FAT32 disk. Is there any API to do this? Many thanks!
The term "scanning" isn't very well defined. Do you want to read each and every byte of each and every file? The easiest way is to use a directory list. Start by pushing the root directory. Then, as long as the directory list is not empty, call FindFirstFile/FindNextFile
to enumerate all files and subdirectories. Add subdirectories to the directory list, and read the files you encounter.
Update: For your purposes, FindFirstFileEx(FindExInfoBasic)
would suffice. You still would want to process only a single directory at a time (breadth-first) instead of entering subdirectories as soon as you see them (depth-first). This is faster because FAT32 directory entries in a single directory are stored together, but subdirectories are typically not stored adjacent to the parent directories.
Check this thread: http://stackoverflow.com/questions/2511672/how-can-i-quickly-enumerate-directories-on-win32
It actually describes FindFirstFile/FindNextFile, but if you need it faster you should go Kernel.
The index solution described in the thread will however not work for FAT32 systems - credit MSalters
Reverse engineer StrongRecovery for NTFS/FAT/FAT32 file recovery, it's really fast and reliable and works fine either for Windows 2000/XP/Vista/7 :P
It's not legal but it should help you ;)