473,587 Members | 2,547 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to get a list of available drives (partitions) in windows

yes, that's the simple question:

is there some python standard or 'Python for Windows Extensions'
functionality to iterate or list-return the available drives ('A:',
'B:', 'C:', ...) on a machine running windows?

Thx in advance.
Jul 18 '05 #1
3 10270
from os import *
from os.path import *

def find_drives(env ):

L = []

if(env == 'WINDOWS'):

for i in range(ord('a'), ord('z')+1):
drive = chr(i)

if(exists(drive +":\\")):
L.append(drive)

return L

elif(environnem ent == 'UNIX'):

return L

Frank Bechmann wrote:
yes, that's the simple question:

is there some python standard or 'Python for Windows Extensions'
functionality to iterate or list-return the available drives ('A:',
'B:', 'C:', ...) on a machine running windows?

Thx in advance.


Jul 18 '05 #2
Frank Bechmann wrote:
is there some python standard or 'Python for Windows Extensions'
functionality to iterate or list-return the available drives ('A:',
'B:', 'C:', ...) on a machine running windows?


http://www.faqts.com/knowledge_base/view.phtml/aid/4670
Alex

Jul 18 '05 #3
thx for the quick help!

seemed to be a problem that's not easy to be googled.

and sorry in advance for the double-post which will show up soon.
Jul 18 '05 #4

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

Similar topics

0
2196
by: python-help-bounces | last post by:
Your message for python-help@python.org, the Python programming language assistance line, has been received and is being delivered. This automated response is sent to those of you new to python-help, to point out a few resources that can help with answering your own questions, or improve the chances of getting a useful answer from the...
41
3519
by: Xah Lee | last post by:
here's another interesting algorithmic exercise, again from part of a larger program in the previous series. Here's the original Perl documentation: =pod merge($pairings) takes a list of pairs, each pair indicates the sameness of the two indexes. Returns a partitioned list of same indexes.
6
13189
by: cantabile | last post by:
Hi, I'd like to get drives and partitions (and their size too) with python under Linux. So far, I thought of reading /proc/partitions but maybe i could use fdsik also ? How would I do that in python ? Thanks for your help (newbie here :) )
3
2476
by: Ned Hart | last post by:
I'm formatting my mirrored drives and installing a third drive for raid 5 to add more space. I have backup exec. Can anyone tell me the best way to backup SQL so I can be sure it will restore properly? I was thinking of using imaging software and creating an image to a USB 2.0 hard drive. The DB is 80 gigs. Thanks NH
4
1991
by: James Kunicki | last post by:
Hello, I would like to know if anyone as found a way to list a image next to a list box to indicate what type of drive (local or network) and a folder I would like to present in a user interface like the OpenFileDialog that has a pulldown(at the top of the dialog) to allow a user to navigate a directory/folder selection.
11
2255
by: Madison Kelly | last post by:
Hi all, I am new to the list and I didn't want to seem rude at all so I wanted to ask if this was okay first. I have a program I have written in perl which uses a postgresSQL database as the backend. The program works but the performance is really bad. I have been reading as much as I can on optimizing performance but still it isn't very...
1
1563
by: Computer Guru | last post by:
Does .NET have a wrapper to list actual physical drive volumes on the local PC? My.Computer.Filesystem.Drives lists the partitions and volumes that have drive letters attached. I'm looking to list any and all drives and partitions on the PC, including non-Windows partitions that may not be mounted under Windows. Thanks.
1
1566
Beshr
by: Beshr | last post by:
Hey all! Another fast question! How can I get a list of all available hard disk partitions on the current computer! I managed to work out one my self but it works only with Windows! Any one knows a Cross-platform way? I want it to work on my linux! thnx
5
16110
by: =?Utf-8?B?QWxleCBLLg==?= | last post by:
Hi all How do I get the list of all physical disks attached to my computer, similar to what is displayed under Disk drives in Device Manager: 0: MAXTOR 6L040j2 1: ST3802110a Thank you
0
7920
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7849
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...
0
8215
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7973
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...
0
6626
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...
0
3844
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2358
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
1
1454
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.