?
Solved

My.computer.filesystem and network drives

Posted on 2006-03-30
11
Medium Priority
?
620 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?
0
Comment
Question by:PacerIT
  • 4
  • 3
  • 2
9 Comments
 
LVL 39

Expert Comment

by:appari
ID: 16337351

what are you entering in Me.TextBox1.Text
did you try mapping the network path to a drive and use that path?
0
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 2000 total points
ID: 16337416
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
 

Author Comment

by:PacerIT
ID: 16337535
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 39

Expert Comment

by:appari
ID: 16338438

whats the error?
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 16338456
"Illegal characters in path."
0
 

Author Comment

by:PacerIT
ID: 16342364
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
 

Author Comment

by:PacerIT
ID: 16342576
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
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 16343376
So it was an illegal character in the file name.
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 16349729
Hi Netminder;

Please note my answers above on this question:
    03/30/2006 02:05PM PST
    03/30/2006 04:56PM PST
   
Fernando
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Screencast - Getting to Know the Pipeline

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question