Ok, I hope this isn't to confusing. Tried to explain my problem as best as I can!
The error I get is :
{System.Net.WebException: An exception occurred during a WebClient request. ---> System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
at System.IO.Path.GetFileName(String path)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at System.Net.WebClient.DownloadFile(Uri address, String fileName)
--- End of inner exception stack trace ---
at System.Net.WebClient.DownloadFile(Uri address, String fileName)
at System.Net.WebClient.DownloadFile(String address, String fileName)
at download_audio_files.Form1.download_files(String URL, String filename) in C:\Users\nick\AppData\Local\Temporary Projects\download_audio_files\Form1.vb:line 29
}
I have this code (changed slightly for privacy) :
with each FOR, URL EQUALS =
The first URL (It works, downloads no problem and moves on to the next)
URL="http://admin.google.com/Media/CallAudio/1E4A72C7A5E849977898ED39DEE079E1/NA3Y-3zXWAxazYhfMshwEs/94491/20131002120542-VS8-753.au"
and then (AT THIS POINT I GET AN ERROR)
URL="http://admin.google.com/Media/CallAudio/9189CFD1E0C51B9AFF4DF80272BCD555/NA3Y-3zXW1rhSBhzD~hGcs/94491/20131002115116-vs7-383.au"
end if it would get to it, the next url would be :
URL="http://admin.google.com/Media/CallAudio/BE6C48B7DB73CF984FD2CEE2FAA7C1D3/NA3Y-3zXW1QuzShzD~h0c2/94491/20131002114040-vs7-985.au"
Filename would =
"1.au"
"4.au"
"7.au"
audio_work_file.txt looks like this :"
1|Persons Name A|(111) 111-111|Sales|3.3 min|10/2/2013 2:05:42 PM|http://admin.google.com/Media/CallA...AxazYhfMshwEs/94491/20131002120542-VS8-753.au
4|Persons Name B|(222) 222-222|Sales|2.8 min|10/2/2013 1:51:16 PM|http://admin.google.com/Media/CallA...1rhSBhzD~hGcs/94491/20131002115116-vs7-383.au
7|Persons Name C|(333) 333-333|Sales|3.3 min|10/2/2013 1:40:41 PM|http://admin.google.com/Media/CallA...1QuzShzD~h0c2/94491/20131002114040-vs7-985.au
"
If I change
For x = 0 To audio_list_split.Count - 1
TO
For x = 1 To audio_list_split.Count - 1
it gives me the same error right away.
If I copy the first line form audio_work_file.txt, so it looks like this :
1|Persons Name A|(111) 111-111|Sales|3.3 min|10/2/2013 2:05:42 PM|http://admin.google.com/Media/CallA...Y-3zXWAxazYhfMshwEs/94491/20131002120542-VS8-
753.au
2|Persons Name A|(111) 111-111|Sales|3.3 min|10/2/2013 2:05:42 PM|http://admin.google.com/Media/CallA...AxazYhfMshwEs/94491/20131002120542-VS8-753.au
4|Persons Name B|(222) 222-222|Sales|2.8 min|10/2/2013 1:51:16 PM|http://admin.google.com/Media/CallA...1rhSBhzD~hGcs/94491/20131002115116-vs7-383.au
7|Persons Name C|(333) 333-333|Sales|3.3 min|10/2/2013 1:40:41 PM|http://admin.google.com/Media/CallA...1QuzShzD~h0c2/94491/20131002114040-vs7-985.au
It still crashes on the 2nd file, even though it just downloaded it no problem.
What is going on here? I'm so confused! I can't see any illegal characters, but I am guessing that the file system is still busy and can't create a new file? or ... I don't know!!
Any and all help is greatly appreciated!
Thanks
Nick
The error I get is :
{System.Net.WebException: An exception occurred during a WebClient request. ---> System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
at System.IO.Path.GetFileName(String path)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at System.Net.WebClient.DownloadFile(Uri address, String fileName)
--- End of inner exception stack trace ---
at System.Net.WebClient.DownloadFile(Uri address, String fileName)
at System.Net.WebClient.DownloadFile(String address, String fileName)
at download_audio_files.Form1.download_files(String URL, String filename) in C:\Users\nick\AppData\Local\Temporary Projects\download_audio_files\Form1.vb:line 29
}
I have this code (changed slightly for privacy) :
VB.NET:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim audio_list As String = Application.StartupPath & "\audio_work_file.txt"
Dim audio_list_text As String = My.Computer.FileSystem.ReadAllText(audio_list)
Dim audio_list_split() As String = audio_list_text.Split(vbCrLf)
For x = 0 To audio_list_split.Count - 1
Dim an_item_split() As String = audio_list_split(x).Split("|")
If an_item_split(an_item_split.Count - 1) <> "not found" Then
download_files(an_item_split(an_item_split.Count - 1), an_item_split(0) & ".au")
End If
Next x
MsgBox("All Done")
End Sub
Public Sub download_files(ByVal URL As String, ByVal filename As String)
Dim myWebClient As New WebClient()
Try
myWebClient.DownloadFile(URL, filename)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
with each FOR, URL EQUALS =
The first URL (It works, downloads no problem and moves on to the next)
URL="http://admin.google.com/Media/CallAudio/1E4A72C7A5E849977898ED39DEE079E1/NA3Y-3zXWAxazYhfMshwEs/94491/20131002120542-VS8-753.au"
and then (AT THIS POINT I GET AN ERROR)
URL="http://admin.google.com/Media/CallAudio/9189CFD1E0C51B9AFF4DF80272BCD555/NA3Y-3zXW1rhSBhzD~hGcs/94491/20131002115116-vs7-383.au"
end if it would get to it, the next url would be :
URL="http://admin.google.com/Media/CallAudio/BE6C48B7DB73CF984FD2CEE2FAA7C1D3/NA3Y-3zXW1QuzShzD~h0c2/94491/20131002114040-vs7-985.au"
Filename would =
"1.au"
"4.au"
"7.au"
audio_work_file.txt looks like this :"
1|Persons Name A|(111) 111-111|Sales|3.3 min|10/2/2013 2:05:42 PM|http://admin.google.com/Media/CallA...AxazYhfMshwEs/94491/20131002120542-VS8-753.au
4|Persons Name B|(222) 222-222|Sales|2.8 min|10/2/2013 1:51:16 PM|http://admin.google.com/Media/CallA...1rhSBhzD~hGcs/94491/20131002115116-vs7-383.au
7|Persons Name C|(333) 333-333|Sales|3.3 min|10/2/2013 1:40:41 PM|http://admin.google.com/Media/CallA...1QuzShzD~h0c2/94491/20131002114040-vs7-985.au
"
If I change
For x = 0 To audio_list_split.Count - 1
TO
For x = 1 To audio_list_split.Count - 1
it gives me the same error right away.
If I copy the first line form audio_work_file.txt, so it looks like this :
1|Persons Name A|(111) 111-111|Sales|3.3 min|10/2/2013 2:05:42 PM|http://admin.google.com/Media/CallA...Y-3zXWAxazYhfMshwEs/94491/20131002120542-VS8-
753.au
2|Persons Name A|(111) 111-111|Sales|3.3 min|10/2/2013 2:05:42 PM|http://admin.google.com/Media/CallA...AxazYhfMshwEs/94491/20131002120542-VS8-753.au
4|Persons Name B|(222) 222-222|Sales|2.8 min|10/2/2013 1:51:16 PM|http://admin.google.com/Media/CallA...1rhSBhzD~hGcs/94491/20131002115116-vs7-383.au
7|Persons Name C|(333) 333-333|Sales|3.3 min|10/2/2013 1:40:41 PM|http://admin.google.com/Media/CallA...1QuzShzD~h0c2/94491/20131002114040-vs7-985.au
It still crashes on the 2nd file, even though it just downloaded it no problem.
What is going on here? I'm so confused! I can't see any illegal characters, but I am guessing that the file system is still busy and can't create a new file? or ... I don't know!!
Any and all help is greatly appreciated!
Thanks
Nick