473,386 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Identifying the drives available on a system

Hi there everyone,

I'm hoping that someone could point me in the direction of the necessary
classes required to determine information on a computers filesystem. In
particular, how can enumerate the drives that a computer has.

I need to identify the drives available, along with their types (cd, dvd,
disk etc) and then I need to make a tree structure that shows the users the
drives present. Very similar to Explorer really.

Any help would be great

Thanks all

Simon
Nov 15 '05 #1
3 3608
System.IO.Directory.GetLogicalDrives() gets you a list of all drives.

For more detailed info (like types) you can use :

ManagementObjectSearcher query = new ManagementObjectSearcher("SELECT * From
Win32_LogicalDisk ");
ManagementObjectCollection queryCollection = query.Get();

HTH

Yves

"Simon Harvey" <si**********@the-web-works.co.uk> schreef in bericht
news:eT**************@TK2MSFTNGP11.phx.gbl...
Hi there everyone,

I'm hoping that someone could point me in the direction of the necessary
classes required to determine information on a computers filesystem. In
particular, how can enumerate the drives that a computer has.

I need to identify the drives available, along with their types (cd, dvd,
disk etc) and then I need to make a tree structure that shows the users the drives present. Very similar to Explorer really.

Any help would be great

Thanks all

Simon

Nov 15 '05 #2
You can retrieve this info through WMI:
http://www.csharphelp.com/archives2/archive334.html

You'll need this one:
Win32_LogicalDisk
http://tinyurl.com/yrdwf

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Simon Harvey" <si**********@the-web-works.co.uk> schreef in bericht
news:eT**************@TK2MSFTNGP11.phx.gbl...
Hi there everyone,

I'm hoping that someone could point me in the direction of the necessary
classes required to determine information on a computers filesystem. In
particular, how can enumerate the drives that a computer has.

I need to identify the drives available, along with their types (cd, dvd,
disk etc) and then I need to make a tree structure that shows the users the drives present. Very similar to Explorer really.

Any help would be great

Thanks all

Simon

Nov 15 '05 #3
Simon,

You should be able to use the classes in the System.Management namespace
and query for all instances of the Win32_DiskDrive WMI class. It should
give you the information about the drives on the system that you are looking
for.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Simon Harvey" <si**********@the-web-works.co.uk> wrote in message
news:eT**************@TK2MSFTNGP11.phx.gbl...
Hi there everyone,

I'm hoping that someone could point me in the direction of the necessary
classes required to determine information on a computers filesystem. In
particular, how can enumerate the drives that a computer has.

I need to identify the drives available, along with their types (cd, dvd,
disk etc) and then I need to make a tree structure that shows the users the drives present. Very similar to Explorer really.

Any help would be great

Thanks all

Simon

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Read Roberts | last post by:
I wrote my own directory browser in order to get around a bug where tkFileDialog.askdirectory() can't handle non-ascii paths. However, I have a problem where I call os.listdir() on a mapped...
2
by: Jim Richards | last post by:
I have been told by a local PC club technician that 98SE cannot read NTFS drives in a network. Is this true? TIA, Jim.
2
by: lastusernameleft | last post by:
Is there a .NET method for doing this? I haven't found anything else that works. Thanks
36
by: Ron Johnson | last post by:
http://hardware.devchannel.org/hardwarechannel/03/10/20/1953249.shtml?tid=20&tid=38&tid=49 -- ----------------------------------------------------------------- Ron Johnson, Jr....
3
by: Flix | last post by:
I need to detect the root directories of the installed hard disks (es: C:, D:, E:, etc.). I'm not interested in cd drives. I know that there is a way (a bit slow, if I remeber) to retrive all the...
4
by: GregT | last post by:
Is there a way to programmatically identify a local CD drive/drives from a local machine. Currently, I am calling System.IO.Directory.GetLogicalDrives() - but this lists all the drives on the...
4
by: Phillip N Rounds | last post by:
I need to eumerate all available drives in a C# Windows Form application ( and then of course the directory tree, but that's not the problem) My question is, how to I enumerate all the available...
7
by: BWill | last post by:
Hi, I'm writing a file browser, but I'm not sure how I could go about detecting the drives available on windows and linux systems (preferably using the standard modules if possible). I guess I...
1
by: DBC User | last post by:
I have a program in the network location, which when running, it needs to find out what are all the drives available in the PC. I have the following code in my program using (ManagementClass...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.