How to get the total size of a local hard disk?

Paul Boddie paul at boddie.org.uk
Mon Jun 15 09:48:17 EDT 2009


On 15 Jun, 14:58, willgun <will... at live.cn> wrote:
>
> How to get the total size of a local hard disk?
> I mean total size,not free space.

Which platform are you using? On a Linux-based system you might look
at the contents of /proc/partitions and then, presumably with Python,
parse the contents to yield a number of blocks for the hard disk in
question. This quantity would then be converted into a more familiar
measure.

One might expect something like PSI to support this kind of
activity...

http://bitbucket.org/chrismiles/psi/

...but I think it only really provides process-related information.

Paul



More information about the Python-list mailing list