We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

My.computer.filesystem and network drives

PacerIT
PacerIT asked
on
Medium Priority
723 Views
Last Modified: 2012-05-05
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?
Comment
Watch Question

Commented:

what are you entering in Me.TextBox1.Text
did you try mapping the network path to a drive and use that path?
Retired
CERTIFIED EXPERT
Distinguished Expert 2017
Commented:
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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

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

Commented:

whats the error?
Fernando SotoRetired
CERTIFIED EXPERT
Distinguished Expert 2017

Commented:
"Illegal characters in path."

Author

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?

Author

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 SotoRetired
CERTIFIED EXPERT
Distinguished Expert 2017

Commented:
So it was an illegal character in the file name.
Fernando SotoRetired
CERTIFIED EXPERT
Distinguished Expert 2017

Commented:
Hi Netminder;

Please note my answers above on this question:
    03/30/2006 02:05PM PST
    03/30/2006 04:56PM PST
   
Fernando
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.