I am successfully downloading a zipped CSV file from the web. I am also able to unzip it and save it to a CSV file and then parse it to a much smaller text file. I want to rewrite all three files each time I down load. I insert the date as you can see in the File name because the filename contains the daily date. Because the file changes daily, I want to use the latest version. Here is my code.
Try
My.Computer.Network.DownloadFile(URL, "C:\Ra\List\ValidList" & myDate & ".zip", "", "", False, 1000, True)
Catch
MsgBox("You may not be connected to the Internet, Connect and try again")
Exit Sub
End Try
Try
Dim zipPath As String = "C:\Ra\List\ValidList" & myDate & ".zip"
Dim extractPath As String = "C:\Ra\List"
ZipFile.ExtractToDirectory(zipPath, extractPath)
Catch ex As Exception
MsgBox("The File may already exist...continue.")
End Try
I could delete all three files before downloading but I think I can overwrite each which I would prefer.
What I have tried:
I have tried changing the last three parameters in the My.Computer.Network.Download(URL, Save to filename, Parameter 1, Time parameter, Parameter 2) But MSDN does not say which parameter is which...i.e., view download progress or overwrite file, and when testing I get inconsistent results.