Drive space

Trent Mick trentm at ActiveState.com
Tue Aug 13 04:26:00 CEST 2002


[Ken Seehof wrote]
> How do you get the total remaining drive space, given the drive letter, on
> Windows?

Parse the output of "dir" (using os.popen to call it) or learn how to
use the win32pdh module (part of the PyWin32 extensions, which are
included in your Python installation if you use ActivePython).

There are example uses of win32pdh here:
    <python-install-dir>\Lib\site-packages\win32\Lib\win32pdhquery.py
    <python-install-dir>\Lib\site-packages\win32\Lib\win32pdhutil.py

See MSDN for API details:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/perfmon/perfdata_4gtv.asp

Cheers,
Trent

-- 
Trent Mick
TrentM at ActiveState.com




More information about the Python-list mailing list