and network drives

I wrote an app in 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

The actual move code ( 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?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


what are you entering in Me.TextBox1.Text
did you try mapping the network path to a drive and use that path?
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).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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..
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.


whats the error?
Fernando SotoRetiredCommented:
"Illegal characters in path."
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?
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...
Fernando SotoRetiredCommented:
So it was an illegal character in the file name.
Fernando SotoRetiredCommented:
Hi Netminder;

Please note my answers above on this question:
    03/30/2006 02:05PM PST
    03/30/2006 04:56PM PST
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.