r3plica
Well-known member
- Joined
- Mar 4, 2010
- Messages
- 86
- Programming Experience
- 3-5
I have this website that stores my template files for Word, Excel, etc and I need to be able to download them through my .Net Application.
I can easily download a file if I know the name, but I want it to parse all the files in the given web directory and download them, without me having to specify the file names.....
The code I have to download a single file (when I know the filename) is:
So now I basically need for find a way to loop the files on the website, and then download them.
Could someone help me out with this, I have searched everywhere....
I can easily download a file if I know the name, but I want it to parse all the files in the given web directory and download them, without me having to specify the file names.....
The code I have to download a single file (when I know the filename) is:
VB.NET:
Private Shared Sub DownloadFile(ByVal uri As String, ByVal DestinationFile As String, Optional ByVal username As String = Nothing, Optional ByVal pwd As String = Nothing)
Dim wc As New System.Net.WebClient
If Not username Is Nothing AndAlso Not pwd Is Nothing Then
wc.Credentials = New System.Net.NetworkCredential(username, pwd)
End If
wc.DownloadFile(uri, DestinationFile)
End Sub
So now I basically need for find a way to loop the files on the website, and then download them.
Could someone help me out with this, I have searched everywhere....