Solved

Determine whether a folder is on the local computer

Posted on 2016-09-12
2
23 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 62

Accepted Solution

by:
Fernando Soto earned 500 total points
Comment Utility
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
Comment Utility
Thanks, Fernando. That does the trick.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now