[python-win32] How can I get total size of hard disk?
Thomas Hervé
therve at neocles.com
Wed Apr 21 04:16:28 EDT 2004
Hi,
Y.H. Rhiu wrote:
>How can I get total size of hard disk?
>
[...]
>Any ideas?
>
>
WMI is a solution, but you can do without too :
<code>
drives = string.splitfields(win32api.GetLogicalDriveStrings(),
'\\\x00')[0:-1]
for d in drives :
d_type = win32file.GetDriveType(d)
# We only want local drives
if d_type == win32file.DRIVE_FIXED :
d_size = win32file.GetDiskFreeSpaceEx(d)
print "Disk %s : %d free on %d" % (d, d_size[2], d_size[1])
</code>
>Thanks.
>
>
Hope this helps.
>__
>Y.H. Rhiu
>
>
--
Thomas Herve
More information about the Python-win32
mailing list