Im writing my own little automatic FTP program that will backup web sites. Im using the WinInet API. I created a function which utilizes FtpFindFirstFile() & InternetFindNextFile(). This function gets called recursively whenever it find a subdirectory. The biggest problem im having is when I try to traverse a directory tree using FtpFindFirstFile() & InternetFindNextFile(). When the code detects a subdirectory and I call my function recurses, I have to call FtpFindFirstFile() again inside of that recursive call. In order for that to work, I needed to have closed the hFind in the calling function. When the recursive function returns, I find myself having to call FtpFindFirstFile() again in the calling function in which it simply finds the same folder again. An endless loop.
I can't seem to figure a way around it. Does anyone have any good code snippets or ideas for traversing a tree using WinInet FTP functions?
Thanks for the help,