Question : Download Multiple Files

I am looking at usings system.net.webclient to download multiple files.  The function .DownloadFileAsync only supports downloading one file at a time.  My question is how can I get a file list from the remote server so I can enumerate through the files and/or is their a better library to use.

Answer : Download Multiple Files

Thank you for your response.  I was able to work out a managed code solution from some blogs I eventually found.  I am surprised how long it took to get a response for this question.  I figured this would be something easy that I was just overlooking.  Anyway, thank your for your solution.  I will award you the points but I think that I will continue to use the solution that I came up with.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
Public Function GetFileList(ByVal rootpath As String, ByVal Directory As String) As ArrayList
        Dim ftpserverip As String
        Dim ftpuserid As String = "userid"
        Dim ftppassword As String = "password"
        Dim strList As New ArrayList
        Dim sr As StreamReader = Nothing
        Dim fwr As FtpWebRequest
 
        rootpath.Replace("ftp://", "")
        If Not rootpath.EndsWith("/") Then
            rootpath += "/"
        End If
        ftpserverip = rootpath & Directory
 
        Try
            fwr = DirectCast(FtpWebRequest.Create(New Uri("ftp://" + ftpserverip)), FtpWebRequest)
            fwr.Credentials = New NetworkCredential(ftpuserid, ftppassword)
            fwr.Method = WebRequestMethods.Ftp.ListDirectoryDetails
            fwr.UsePassive = False
            sr = New StreamReader(fwr.GetResponse().GetResponseStream())
        Catch ex As WebException
            Dim status As String = DirectCast(ex.Response, FtpWebResponse).StatusDescription
            MsgBox(status, MsgBoxStyle.Information, "It didn't work")
        End Try
 
        If Not sr Is Nothing Then
            Dim str As String = sr.ReadLine()
 
            Do While Not sr.EndOfStream
                If Not str.ToUpper.Contains("") Then
                    str = str.Substring(str.IndexOf(" ")).Trim
                    str = str.Substring(str.IndexOf(" ")).Trim
                    str = str.Substring(str.IndexOf(" ")).Trim
                    strList.Add(str)
                End If
                str = sr.ReadLine()
            Loop
            sr.Close()
            sr = Nothing
            fwr = Nothing
        End If
 
        Return strList
    End Function
Random Solutions  
 
programming4us programming4us