Determining disk space

Erno Kuusela erno-news at erno.iki.fi
Mon Feb 26 23:31:51 EST 2001


In article <3A9B2ABA.AFFC65EC at esands.com>, Gary Quinn
<gary at esands.com> writes:

| What is the best way using Python to determine the number of bytes
| remaining on a disk?

works for me under linux:

>>> import os, statvfs
>>> x = os.statvfs('/tmp')
>>> print 'space in kB:', x[statvfs.F_BAVAIL] * x[statvfs.F_BSIZE] >> 10
space in kB: 789764

  -- erno



More information about the Python-list mailing list