I wrote an app in vb.net 2005 that monitors a directory for certain types of files and when it finds them it moves them to specified locations.. It works fine on a local drive, but when I try to have it monitor a network drive I get an "Illegal characters in path." error. This is what I have so far:
Dim fileName As String
For Each fileName In My.Computer.FileSystem.GetFiles(Me.TextBox1.Text) <------- error happens here when its a network drive
Dim FileInfo As System.IO.FileInfo
FileInfo = New System.IO.FileInfo(fileName)
If FileInfo.Name.ToLower.StartsWith(Me.txtHeader1.Text) And FileInfo.Extension = "." & Me.txtExt1.Text Then
My.Computer.FileSystem.MoveFile(Fileinfo.FullName, me.txtDest1.text & FileInfo.Name)
The actual move code (my.computer.filesystem.movefile) works fine when i hard code in a file name on the network drive so I have no idea what the problem is.. the whole segment also works fine when its set to monitor a local drive.. it goes through each file and moves only the ones i have specified..