We have encountered an unexpected performance issue when traversing directories looking for files using a wildcard pattern.
We have 180 folders each containing 10,00
Try IShellFolder::EnumObjects with SHGetDataFromIDList/IShellFolder::GetAttributesOf.
Pro/Cons here.
You can try with an implementation of FindFirstFile and FindNextFile I once blogged about.
In my tests using FindFirstFileEx with FindExInfoBasic and FIND_FIRST_EX_LARGE_FETCH is much faster than the plain FindFirstFile.
Scanning 20 folders with ~300,000 files took 661 seconds with FindFirstFile and 11 seconds with FindFirstFileEx. Subsequent calls to the same folders took less than a second.
HANDLE h=FindFirstFileEx(search.c_str(), FindExInfoBasic, &data, FindExSearchNameMatch, NULL, FIND_FIRST_EX_LARGE_FETCH);