Click here to Skip to main content
11,920,413 members (54,398 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#3.0 C# C#4.0
Hi Guys,

I have the following scenario:

I have a directory name : Management Server

I need to find out through code where this directory is whether it is in Program Files or Program Files (x86) or on another drive on the computer

Is there a way to do this?

Thanks in advance!
Posted 13-Jun-12 1:20am
Edited 13-Jun-12 1:44am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1


why dont you use
string[] l_dir = Directory.GetDirectories API to search out the reqd directory.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Do you know the program which created that directory? If not, you could follow the "Solution" described by nitin-aem which might take a very long time to execute...
But if you know it, find out
(1) that that program is installed (otherwise that folder won't exist)
(2) how that program stores its settings (some ini files, xml files, registry keys etc...) and read it from their settings
With a newer version of that program, things may change...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 415
1 phil.o 170
2 Dave Kreskowiak 155
3 KrunalRohit 134
4 F-ES Sitecore 130
0 OriginalGriff 6,778
1 KrunalRohit 4,530
2 Sergey Alexandrovich Kryukov 3,203
3 George Jonsson 2,815
4 Suvendu Shekhar Giri 2,181

Advertise | Privacy | Mobile
Web03 | 2.8.151120.1 | Last Updated 13 Jun 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100