473,397 Members | 1,974 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,397 software developers and data experts.

Re: listing computer hard drives with python

Ohad Frand wrote:
I am looking for a way to get a list of all active logical hard drives
of the computer (["c:","d:"..])
You can do this with WMI[*] under Windows:

<code>
import wmi

c = wmi.WMI ()
for i in c.Win32_LogicalDisk ():
print i.Caption

</code>

If you want only fixed disks (ie exluding external drives,
USB and CD drives etc) then specify DriveType=3:

<code>
import wmi

c = wmi.WMI ()
for i in c.Win32_LogicalDisk (DriveType=3):
print i.Caption

</code>
[*] http://timgolden.me.uk/python/wmi.html

TJG

Jun 27 '08 #1
0 1265

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

Similar topics

3
by: Bolin | last post by:
I was wondering how to get some system info from a PC running Windows in python. I am especially interested in knowing how much RAM the computer has, how much diskspace is still left, and what jobs...
3
by: Galbu | last post by:
Hi all, here's my problem. I've got to collect some information about the drives in a computer. With the hd I've no problems, I use the GetDriveType Api. But how can I know if a cd-rom drive is a...
5
by: Michael C | last post by:
....on a remote machine? Thanks, Michael C.
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...
11
by: Claude Henchoz | last post by:
Hi Is there any way of listing partitions on a (win32) computer without using WMI? Cheers, Claude
1
by: snow | last post by:
Your question, how do I speed up my computer? You get frustrated when your computer is very slow. You can now save yourself from aggravation especially when you are very busy working. I will show...
2
by: subsanta | last post by:
My computer has so many problems and ive looked around on the internet and ive managed to fix some of them. I know that i have a few viruses on my computer, but i cant get rid of them, in one case i...
0
by: Winder | last post by:
Computer Data Recovery Help 24/7 Data recovering tools and services is our focus. We will recover your data in a cost effective and efficient manner. We recover all operating systems and media....
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.