listing computer hard drives with python

python newbie p.newbie at yahoo.com
Mon May 5 20:55:10 EDT 2008


Sorry, I forgot to copy the list.

Looks like you are doing this on Windows.  Windows has a built in command call fsutil that would work in this situation.  The syntax would be:

C:\Documents and Settings\username>fsutil fsinfo drives

Drives: C:\ D:\ E:\

To find out the type of drive you can use:

C:\Documents and Settings\username>fsutil fsinfo drivetype c:

c: - Fixed Drive

On a side note you can call an external command via:

import os
os.system('fsutil fsinfo drives')
os.system('fsutil fsinfo drivetype c:')

I hope this helps.

PS: I am not sure about the privileges  that are required to run fsutil.

Disclaimer: I am new to python and programming.  This may not be they python way of doing things.

Pete



Ohad Frand <ohad.frand at percello.com> wrote:                        Hi
  I am looking for a way to get a list of all active logical hard drives of the computer (["c:","d:"..])
   
  Thanks,
  Ohad
  
  --
http://mail.python.org/mailman/listinfo/python-list

       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080505/7afaa9be/attachment.html>


More information about the Python-list mailing list