My.computer.filesystem and network drives

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)
                 End If
           
             Next

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..

any ideas?
PacerITAsked:
Who is Participating?
 
Fernando SotoRetiredCommented:
From the Documentation:

The path is not valid for one of the following reasons: it is a zero-length string; it contains only white space; it contains invalid characters; or it is a device path (starts with \\.\) (ArgumentException).

http://msdn2.microsoft.com/en-us/library/t71ykwhb.aspx

0
 
appariCommented:

what are you entering in Me.TextBox1.Text
did you try mapping the network path to a drive and use that path?
0
 
PacerITAuthor Commented:
yes I am entering the mapped drive letter (R:\) in this case into the me.textbox1.text - I have also tried the UNC \\server\share address and same error occurs..
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
appariCommented:

whats the error?
0
 
Fernando SotoRetiredCommented:
"Illegal characters in path."
0
 
PacerITAuthor Commented:
UPDATE: it appears to be only giving this error on a unix samba share thats been mapped to a network drive... it works fine on a share on server 2003 thats been mapped... there are no illegal characters in the name of the share/drive.. any ideas?
0
 
PacerITAuthor Commented:
Thanks for your help all.. I solved the problem.. there was a hidden file on the share with (get this) an illegal character in the file name and that what was causing it to throw up...
0
 
Fernando SotoRetiredCommented:
So it was an illegal character in the file name.
0
 
Fernando SotoRetiredCommented:
Hi Netminder;

Please note my answers above on this question:
    03/30/2006 02:05PM PST
    03/30/2006 04:56PM PST
   
Fernando
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.