I have been using the MGetFiles method and it works great. My question is, I want all the files except .html, .php and .gif files that might be in the directory. I know I can list out all the file types I want, like this:
Dim numFilesDownloaded As IntegerIs there a way to use the method to exclude certain files (in my case the html, php & gif's)?
numFilesDownloaded = ftp.MGetFiles(".txt", "c:/temp") numFilesDownloaded = ftp.MGetFiles(".xxx", "c:/temp") numFilesDownloaded = ftp.MGetFiles("*.crl", "c:/temp")
If (numFilesDownloaded < 0) Then MsgBox(ftp.LastErrorText) Exit Sub End If
(I'm assuming this is VB6.)
Two alternatives immediately come to mind.
1) Use the BeginDownloadFile event callback (see http://www.cknotes.com/?p=357 ) Your app can examine the filename about to be downloaded, and then set the "skip" argument to 1 to prevent it from being downloaded.
2) Write a loop that iterates over the files in the directory (as shown here: http://www.example-code.com/vb/ftp_listDirectory.asp ) and then call GetFile for each file you wish to download. The performance would be the same as for calling MGetFiles.