Results 1 to 5 of 5

Thread: API function for recursive search

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Location
    HK
    Posts
    6

    API function for recursive search

    Hi, is there any API function that can perform recursive search in filesystem. Just similar to the command "Dir xxx.exe /s"

    Thx a lot

  2. #2
    Megatron
    Guest
    Use FindFistFile to begin the search and FindNextFile to continue it.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Location
    HK
    Posts
    6
    Hi Megatron, I have tried to use this API function, but I find that it doesn't support, or it is needed to implement the recursively search for each sub-directories by myself, I wonder if there is any easier method to handle it.

    Thanks for you help

  4. #4
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930
    You have to set up the recursion part yourself. When you get a file out of FindFirstFile()/FindNextFile(), you need to determine if it's a file or dir, and if it's a dir, add it to an array or something, and keep getting the rest of the things in the dir. Then you have to step into each of the saved dirs and repeat the whole process. It can be a lot to handle . There is an example of this at www.allapi.net in the API-List part under those functions if you want to take a look. There are ways to do this with Dir$() as well I believe, but they are extremely slow compared to using the APIs.
    I'm baaaack...
    VB5 Professional Edition, VC++ 6
    Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se

    I feel special because I finally figured out how to loop midis: Post link
    I'm a fanatic too

  5. #5
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530

    Here you are

    A really good example here:
    http://pages.about.com/vbmakai/getfiles.htm

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