Home All Groups Group Topic Archive Search About

System.IO.File.Exists

Author
7 Feb 2006 9:41 PM
raibeart
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

Author
7 Feb 2006 10:14 PM
CMM
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
>
Author
7 Feb 2006 10:19 PM
1388-2/HB
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
>
Author
8 Feb 2006 2:32 PM
Phill W.
"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.

It's always worked for me, so ...

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.
Author
8 Feb 2006 3:02 PM
ArcaneDevil
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
>