Solved

Determine whether a folder is on the local computer

Posted on 2016-09-12
2
28 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 63

Accepted Solution

by:
Fernando Soto earned 500 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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vb.net 2 43
Get the selected ValueMember of Combobox 5 31
VB.NET (2008) - Refactoring Question 2 21
Expression Evaluater 3 26
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

777 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