|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
System.IO.File.ExistsI am trying to use System.IO.File.Exists to determine if a file exiusts
on a server. I am using a UNC path stored in a database table. Is there a way to use UNC rather than a mapped drive? For example: \\Srv09\Data\LogCenter\Logs\log_1.tif will not work x:\LogCenter\Logs\log_1.tif will work Thanks in advance. Robert Really? File.Exists doesn't work on UNC paths? Oh well, I'm sure Dir(file)
still works on unc paths in VB.NET. Use that instead: Dir("\\Srv09\Data\LogCenter\Logs\log_1.tif") <> "" means the files doesn't exist. Show quoteHide quote "raibeart" <raibe***@gmail.com> wrote in message news:1139348461.947037.310600@g43g2000cwa.googlegroups.com... >I am trying to use System.IO.File.Exists to determine if a file exiusts > on a server. I am using a UNC path stored in a database table. Is > there a way to use UNC rather than a mapped drive? > > For example: > > \\Srv09\Data\LogCenter\Logs\log_1.tif will not work > x:\LogCenter\Logs\log_1.tif will work > > Thanks in advance. > > Robert > I use File.IO.Exists against UNC all the time (Windows and/or Novell
servers). No matter how impossibly sure you are the UNC path is correct, I would double check to make sure it's correct. Maybe your WINS/DNS server has an outdated address cached for Srv09, and it's sending your program a bogus address... or the UNC is actually typo'd in the database but you assume it isn't... or it's resolving to Srv09 on some other network somewhere else that doesn't have that share on it, or you're running on Win98 and NETBIOS isn't on, or "something stupid" like that. AFAIk, a valid UNC path should work. Show quoteHide quote "raibeart" <raibe***@gmail.com> wrote in message news:1139348461.947037.310600@g43g2000cwa.googlegroups.com... >I am trying to use System.IO.File.Exists to determine if a file exiusts > on a server. I am using a UNC path stored in a database table. Is > there a way to use UNC rather than a mapped drive? > > For example: > > \\Srv09\Data\LogCenter\Logs\log_1.tif will not work > x:\LogCenter\Logs\log_1.tif will work > > Thanks in advance. > > Robert > "raibeart" <raibe***@gmail.com> wrote in message It's always worked for me, so ...news:1139348461.947037.310600@g43g2000cwa.googlegroups.com... >I am trying to use System.IO.File.Exists to determine if a file exiusts > on a server. I am using a UNC path stored in a database table. In what context are you executing this code? Is it, for example, in a Windows Service, which well /not/ have access to the network at all. HTH, Phill W. UNC paths are usually only what I use. Try browsing to the UNC path by
clicking on Start then Run and copy the path in from the machine that you are executing File.Exists from. If you can't get there then as stated earlier the machine isn't seeing the path correctly. If you can get there then are you executing the code under the same context as the user that you are trying the Start - Run? Show quoteHide quote "raibeart" <raibe***@gmail.com> wrote in message news:1139348461.947037.310600@g43g2000cwa.googlegroups.com... > I am trying to use System.IO.File.Exists to determine if a file exiusts > on a server. I am using a UNC path stored in a database table. Is > there a way to use UNC rather than a mapped drive? > > For example: > > \\Srv09\Data\LogCenter\Logs\log_1.tif will not work > x:\LogCenter\Logs\log_1.tif will work > > Thanks in advance. > > Robert >
question on coding a reset button
need help resolving runtime error EXE vs DLL Creation Draw backs of Serialized Objects Best Practices with In Memory Data Books On VB.NET 2005 Peculiar inconsistency in autogenerated event handler code run a dos command Designing A Process and Report Scheduler/Spooler Application calling vbscript |
|||||||||||||||||||||||