Click here to Skip to main content
12,895,064 members (61,968 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 0:20am
Updated 13-Jun-12 0: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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170424.1 | Last Updated 13 Jun 2012
Copyright © CodeProject, 1999-2017
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