detecting drives for windows and linux

BWill brianwill1 at adelphia.net
Sat Mar 25 21:45:17 CET 2006


Tim Golden wrote:
> BWill wrote:
>> 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 could just try to
>> list root on each letter of the alphabet for windows and see if it
>> works, but that seems crude; besides, I want to know what kind of drive
>> each drive/partition is (i.e. is it local and is it a harddrive or
>> optical drive).
> 
> I'm not aware of any cross-platform way of doing this.
> On Windows you have a few options, but I'd go down
> the WMI route; it just makes life easier for doing this
> kind of thing. You might want to start by adapting this
> example:
> 
> http://tgolden.sc.sabren.com/python/wmi_cookbook.html#percentage_free
> 
> by removing the restriction to fixed disk (DriveType=3)
> 
> TJG
> 

oh, I wasn't expecting a single solution for both platforms, just some 
good solutions

thanks



More information about the Python-list mailing list