?
Solved

Windows: Best way to access files regardless of drive letters (UNC?, Network Share?)

Posted on 2011-05-11
6
Medium Priority
?
385 Views
Last Modified: 2012-05-11
I have several computers with the same directory of files.  The only problem is that on some computers the directory is on the C: drive and on others it's on the D: drive.

How do I abstract this so that my application code can access this directory in a uniform way:

Can UNC be used for this?  I don't need to go over the network.

0
Comment
Question by:ZuZuPetals
6 Comments
 
LVL 4

Expert Comment

by:jmaggio322
ID: 35741445
UNC is the easiest way \\computername\drive$
0
 
LVL 17

Expert Comment

by:sweetfa2
ID: 35741450
The simplest way would be to map them all to a common mapped drive if that options is available.

Othewise create a share for that particular folder on each of the machines and access it via the share.
0
 
LVL 18

Expert Comment

by:dj_alik
ID: 35741451
on startup check  for existing  of  directory  with "if else" in  all possible locations.

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 30

Expert Comment

by:Randy Downs
ID: 35741471
Maybe check UNC path
if file exists on C - Then run your code on C
else check file exists on D - Then run your code on D
endif
0
 
LVL 4

Accepted Solution

by:
GraemeEvans1 earned 2000 total points
ID: 35741527
You can share the directory as a common name on all the computers for share as "datafolder" for example and then use the path \\localhost\datafolder\ to access it on each PC. the name Localhost always points to your own PC.

Otherwise just record where on each PC the the folder is in the registry or an ini file or even an environment variable and have your program look it up each time.
0
 
LVL 2

Author Closing Comment

by:ZuZuPetals
ID: 35757628
Exactly what I was looking for.
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

OfficeMate Freezes on login or does not load after login credentials are input.
IF you are either unfamiliar with rootkits, or want to know more about them, read on ....
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.
Suggested Courses

850 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