With the help of someone on this site I have managed to download specific files from a web site and save them on the local machine.
But now I would like to loop through the folder in the website and one by one collectthe files and on each loop upload the files
Thanks
This bit of code downloads specific files from a website to the local machine
Dim strURL As String = "http://www.test.com/images/"
Dim strFileName() As String = {"image1.jpg", "image2.gif"}
Dim strFullPath As String
Dim wc(1) As WebClient
For i As Integer = 0 To 1
wc(i) = New WebClient
strFullPath = strURL & strFileName(i)
wc(i).DownloadFile(strFullPath, "C:\Farshad\Net\VB\Windows\" & strFileName(i))
wc(i).Dispose()
Next
This bit of code gets all the files in a folder on the local machine...
Dim d() As String
d = System.IO.Directory.GetFiles("C:\Farshad\Net\VB\Files\")
Dim en As System.Collections.IEnumerator
en = d.GetEnumerator
While en.MoveNext
Console.WriteLine(CStr(en.Current))
End While
But now I would like to loop through the folder in the website and one by one collectthe files and on each loop upload the files
Thanks
This bit of code downloads specific files from a website to the local machine
Dim strURL As String = "http://www.test.com/images/"
Dim strFileName() As String = {"image1.jpg", "image2.gif"}
Dim strFullPath As String
Dim wc(1) As WebClient
For i As Integer = 0 To 1
wc(i) = New WebClient
strFullPath = strURL & strFileName(i)
wc(i).DownloadFile(strFullPath, "C:\Farshad\Net\VB\Windows\" & strFileName(i))
wc(i).Dispose()
Next
This bit of code gets all the files in a folder on the local machine...
Dim d() As String
d = System.IO.Directory.GetFiles("C:\Farshad\Net\VB\Files\")
Dim en As System.Collections.IEnumerator
en = d.GetEnumerator
While en.MoveNext
Console.WriteLine(CStr(en.Current))
End While