login about faq

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 Integer

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

Is there a way to use the method to exclude certain files (in my case the html, php & gif's)?

asked Nov 14 '12 at 12:28

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

edited Nov 14 '12 at 12:29


(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.

link

answered Nov 14 '12 at 12:33

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×90
×2
×1

Asked: Nov 14 '12 at 12:28

Seen: 1,179 times

Last updated: Nov 14 '12 at 12:33

powered by OSQA