Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.1k views
in .NET FTP by (1.5k points)
Hi Guys

Is it possible to feed the FileFilter with a string of file names such as "fileA.txt, FileB.txt, fileC.txt" or similar?
If so, what format would the string take?


cheers
Malcom

2 Answers

0 votes
by (162k points)
FileFilter is a delegate

public delegate bool FileFilter(FTPFile file)

so basically you can implement it with anything you like. It just gets passed the FTPFile object and you decide whether to accept the file or not.
0 votes
by (1.5k points)
Thanks Bruce

I thought I could pass it a string of filenames to download but finally figured out it asks about each file as it comes across it at the remote site.
This took me a while to get my head around so in case it helps others, here's my code for this.

I have an array named mediaFiles which contains the names of the files I wish to download. iFiles is the quantity of files therein.


ftpConnection.BeginDownloadMultiple(downloadFolder, New FileFilter(AddressOf filteredFiles), New AsyncCallback(AddressOf OnDownload), ftpConnection)


    Function filteredFiles(ByVal file As FTPFile) As Boolean
        Dim getFile As Boolean = False

        For i As Integer = 1 To iFiles
            If file.Name = mediaFiles(0, i) Then
                getFile = True
                Exit For
            End If
        Next i
        Return getFile
    End Function 'filteredFiles



cheers
Malcom

Categories

...