My program is very simple. All it does is read a file that has file names and their corresponding paths. It then checks to see if the files exist. If not, it writes to another file.
A problem occurs when file names have accents (é) for example. StreamReader cannot read these characters and it returns it as a file not found.
Example:
IO.StreamReader will read the following line:
S:\projacad\PROJET_2005\05020\TQC\BINDÉS\05020-30200-C0-000-2.pdf
and return
S:\projacad\PROJET_2005\05020\TQC\BINDS\05020-30200-C0-000-2.pdf
resulting in an unknown file.
Other than reading the line byte by byte, is there anything quicker I can do?
here is my code
Thanks for taking the time to read and hopefully help.
A problem occurs when file names have accents (é) for example. StreamReader cannot read these characters and it returns it as a file not found.
Example:
IO.StreamReader will read the following line:
S:\projacad\PROJET_2005\05020\TQC\BINDÉS\05020-30200-C0-000-2.pdf
and return
S:\projacad\PROJET_2005\05020\TQC\BINDS\05020-30200-C0-000-2.pdf
resulting in an unknown file.
Other than reading the line byte by byte, is there anything quicker I can do?
here is my code
Thanks for taking the time to read and hopefully help.
VB.NET:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim TextString As String
Dim pathfile As String = "g:\xerox\general\path.txt"
Dim SR As IO.StreamReader = New IO.StreamReader(pathfile)
Dim sw As New System.IO.StreamWriter("g:\xerox\general\NotFound.txt")
'File.OpenRead(pathfile)
Do While SR.Peek() <> -1
TextString = SR.ReadLine()
If File.Exists(TextString) Then
Else
sw.WriteLine(TextString)
End If
Loop
sw.Close()
SR.Close()
MsgBox("done")
End Sub
Last edited: