int main(void)
{
HANDLE hFoundFile;
WIN32_FIND_DATA foundFileData;
SetCurrentDirectory(TEXT("C:\\"));
hFoundFile = FindFirstFileEx(TEXT("*"),FINDEX_INFO_LEVELS::FindExInfoBasic,&foundFileData ,FINDEX_SEARCH_OPS::FindExSearchLimitToDirectories ,NULL , NULL);
do
{
wprintf(TEXT("%s\n"),foundFileData.cFileName);
}
while(FindNextFile(hFoundFile,&foundFileData));
system("Pause");
return 0;
}
Why does it output also “regular” files, although FINDEX_SEARCH_OPS::FindExSearchLimitToDirectories option is explicitly passed to the function?
How to recursively traverse directories in C on Windows
note: Since the flag was added in 2001, any system prior to that point (e.g. Windows 2000, a NAS device built on an old version of Samba) will not support the flag. – Raymond Chen
and within your code: