473,660 Members | 2,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Logical Disk ():
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_Logical Disk (DriveType=3):
print i.Caption

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

TJG

Jun 27 '08 #1
0 1275

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

Similar topics

3
4130
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 are already running and how much memory they take. If this is off-topic, I would appreciate if you redirect me. Thank! B.
3
1300
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 writer, a dvd or somthing else (GetDriveType tells me they are all cd-drives). In the end, how can I know if a removable drives is a floppy, a usb pen or something else? Thanks
5
2484
by: Michael C | last post by:
....on a remote machine? Thanks, Michael C.
3
11668
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 drives using a code like this: ManagementClass diskClass = new ManagementClass("Win32_LogicalDisk"); ManagementObjectCollection disks = diskClass.GetInstances(); foreach (ManagementObject disk in disks) {
11
1862
by: Claude Henchoz | last post by:
Hi Is there any way of listing partitions on a (win32) computer without using WMI? Cheers, Claude
1
1771
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 you 15 steps to do to speed up your computer. http://www.163as.com/news/Speed%20Up.html
2
2855
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 think i have one on my ipod "boot.exe" and i cant get rid of it. All of the antivirus programs ive tried either dont pick it up or cant scan my ipod. Den i have "copy.exe" which i dont know how to fix either. Task manager and regedit were...
0
2063
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. Call for a free consultation. http://a.uuload.com/Computer-Data-Recovery.htm LiveVault's Online Recovery Service Protect vital data with LiveVault's offsite backup and data storage. http://a.uuload.com/Computer-Data-Recovery.htm
0
8341
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8751
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8539
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8630
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7360
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2759
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.