CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2001
    Posts
    39

    How to search for files in Sub-Directories?

    Hi,
    I want to search for files in the current directory and all sub-directories in it but I've only found the FindFirstFile and FindNextFile functions in the WIN32 API. Those functions search the current directory but not the sub-directories.
    Is there any function in the WIN32 API that searches the sub-directories as well?
    Thanx.



  2. #2
    igbrus is offline Elite Member Power Poster
    Join Date
    Aug 2000
    Location
    Los Angeles
    Posts
    4,658

    Re: How to search for files in Sub-Directories?

    No, you should recurse the calls. See for example
    http://63.236.73.79/cgi-bin/bbs/wt/s...&sb=&category=

    Rating isn't important...But gurus respect it and keep high

  3. #3
    Join Date
    Jan 2001
    Posts
    39

    Re: How to search for files in Sub-Directories?

    Thanx.


  4. #4
    Join Date
    Jan 2001
    Posts
    39

    Re: How to search for files in Sub-Directories?

    So, I guess you have to run FindxxxxFile two times, one for to find in the current directory the files you need and second to find the directories in the current folder so you can step in them.
    Is this really the way to go?
    Are you sure that the OS don't have any better way for this?


  5. #5
    igbrus is offline Elite Member Power Poster
    Join Date
    Aug 2000
    Location
    Los Angeles
    Posts
    4,658

    Re: How to search for files in Sub-Directories?

    OS hasn't - see how acts at Windows Explorer Folder Properties. I guess, that my algorithm could be improved, but general direction wouldn't change

    Rating isn't important...But gurus respect it and keep high

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured