Searching for directories only

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?

Answers


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

    WIN32_FIND_DATA FindFileData;
    do {
    
    if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
    
    
    
    
    }
    while(FindNextFile(hFindFile, &FindFileData));
    

and within your code:

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
    {
    if (foundFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
        wprintf(TEXT("%s\n"),foundFileData.cFileName);

    }
    while(FindNextFile(hFoundFile,&foundFileData));

    system("Pause");
    return 0;
}

Need Your Help

Adding text on background Image and zooming the image

javascript html css

I am newbie to HTML, CSS & Javascript. I want to add some background image. After the image is added, can I brake that image into small divs and add text into those divs? Is it possible. As well

Drupal 6 and YUI Editor 2.8, cannot get upload image working

drupal drupal-6 yui wysiwyg yui-editor

Okay, I have installed WYSIWYG module to my Drupal 6 site. I also installed the YUI module v2.8.0r4

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.