How to find out about free space on a given drive?

Cameron Laird claird at starbase.neosoft.com
Mon Mar 19 15:50:44 CET 2001


In article <mailman.984991890.14766.python-list at python.org>,
Steve Purcell  <stephen_purcell at yahoo.com> wrote:
>Dinu Gherman wrote:
>> is there a simple way (or any way at all) to find out for 
>> any given hard disk how much free space is left on that
>> device? I looked into the os module, but either not hard
>> enough or there is no such function. Of course, the ideal
>> solution would be platform-independant, too... :)
>
>os.statvfs() seems to be what you want for UNIX. I don't think you'll find
>a cross-platform solution.
			.
			.
			.
When it matters enough to me, maybe I'll write up (partial)
os.statvfs() implementations for Win*, or even MacOS, perhaps
starting from <URL: http://mini.net/cgi-bin/wikit/526.html >
(see "Disk free capacity") and submit the sources for inclu-
sion in the distribution library.  It surprises me a teensy
bit when I read, "I don't think you'll find a cross-platform
solution", without the "yet" which belongs at the end.
-- 

Cameron Laird <claird at NeoSoft.com>
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html



More information about the Python-list mailing list