using os.stat to determine stat.st_blocks on OS that supports it?

Thomas Wouters thomas at xs4all.net
Mon May 8 16:18:35 EDT 2000


On Mon, May 08, 2000 at 06:39:30PM +0000, Andrew Steingruebl wrote:

> I'm trying to write a disk usage monitoring program.  As part of it, I
> need to determine actual file size/disk-blocks-used.

> If I read the manuals correctly, the os.stat call, even on OS's that
> support extra stat fields, does not return the st_blocks value.

use os.statvfs:

statvfs(path) -> 
 (bsize, frsize, blocks, bfree, bavail, files, ffree, favail, flag, namemax)
Perform a statvfs system call on the given path.

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list