cross platform method Re: How to get the total size of a local hard disk?
usernet at ilthio.net
Mon Jun 15 11:40:53 EDT 2009
On 2009-06-15, Tim Golden <mail at timgolden.me.uk> wrote:
> These kind of things tend to be fairly platform specific.
There is however a way to do it in a cross platform manner which will
return an appoximation of the available space.
1. delete all of the files (and folders) on the partition that you want to
2. create a file as large as the drive will permit.
3. repeat two with as many files as the drive will allow to be written.
This needs to be done on filesystems with file size limits (ie,
FAT file systems will only allow files as large as 4G).
4. Once all the files have been written, calculate the total size of all of
the files to get your answer.
This method is a little descructive and slow; but, it should work on
<warning font="small print">
This is a joke. Do not take it seriously. I do not actually suggest
anybody use this method to measure the size of their drive. I do not take any
responsibility for any damages incurred by using this method. I will laugh
at you if you do. Offer not valid in AK, HI, Puero Rico, or U.S Virgin Ilands.
More information about the Python-list