Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > how to get a list of available drives (partitions) in windows

Reply
Thread Tools

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

 
 
Frank Bechmann
Guest
Posts: n/a
 
      11-09-2003
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.
 
Reply With Quote
 
 
 
 
Nicolas =?ISO-8859-15?Q?Favre=2DF=E9lix?=
Guest
Posts: n/a
 
      11-09-2003
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(environnement == '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.


 
Reply With Quote
 
 
 
 
Alex Martelli
Guest
Posts: n/a
 
      11-09-2003
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

 
Reply With Quote
 
Frank Bechmann
Guest
Posts: n/a
 
      11-09-2003
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Losing Drives - Finding Drives - Losing Drives mel@no.spam.com Computer Support 2 09-21-2007 10:16 PM
need some questions answered if you can re 2 harde drives 2 dvd rw drives anthony crowder Computer Support 1 10-29-2006 08:42 PM
Computer freezes with external USB hard drives - jump drives work Zap Eagle Computer Support 3 07-13-2006 04:36 PM
Enumerate all the drives including Mapped network drives on a serv =?Utf-8?B?UHJhZGVlcCBTdW5kYXJhbShNU0ZUKQ==?= ASP .Net 2 02-26-2005 03:13 PM



Advertisments