By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,255 Members | 1,270 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,255 IT Pros & Developers. It's quick & easy.

System.IO.File.Exists

P: n/a
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

Feb 7 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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.

"raibeart" <ra******@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.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

Feb 7 '06 #2

P: n/a
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.

"raibeart" <ra******@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.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

Feb 7 '06 #3

P: n/a
"raibeart" <ra******@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.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.
Feb 8 '06 #4

P: n/a
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?
"raibeart" <ra******@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.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

Feb 8 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.