Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Determine whether a folder is on the local computer

Posted on 2016-09-12
2
Medium Priority
?
43 Views
Last Modified: 2016-09-12
My VB 2008 application has configuration files which may be stored either locally or in a server folder. However, if they're stored on the server, the issue arises that a laptop might be used when the server is not accessible. I want to have a fallback process that will determine, if the file is not found (that is, if File.Exists returns False), if it's looking for a server location; if so, I would assume that the server is inaccessible and check a secondary location for the configuration information. If we're looking at the local computer, then I would assume the file doesn't exist, either because it's a new installation or because someone wiped out the file, and I would reinitialize.

I'm not sure how to determine whether the folder location is on the local computer or a server. If it starts with a "\\", of course, that would be a strong indicator of a network location. But a drive letter other than C: is ambiguous; it could be a second physical or logical drive, or it could be a mapped network drive. Can you suggest a way to know whether it's local or network?
0
Comment
Question by:ElrondCT
2 Comments
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 2000 total points
ID: 41794867
Hi  ElrondCT;

Have your tried using DriveInfo class to find all the drives on the local system whether they are CDRom, Fixed, Network, NoRootDirectory, Ram, Removable, or Unknown. It can also report if the drive IsReady and other information.
0
 
LVL 20

Author Comment

by:ElrondCT
ID: 41795307
Thanks, Fernando. That does the trick.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

971 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