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 ;)
Printable View
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 ;)
Use FindFistFile to begin the search and FindNextFile to continue it.
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:D
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.
A really good example here:
http://pages.about.com/vbmakai/getfiles.htm