using os.stat to determine stat.st_blocks on OS that supports it?
Andrew Steingruebl
steingra at pprd.abbott.com
Mon May 8 14:39:30 EDT 2000
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.
Anyone have any suggestions to figuring out the actual disk usage of a
file? I'm just going to guess that a program like "du" uses st_blocks.
I don't want to call out to an external program, but obviously the
st_blocks isn't getting returned as one of the fields from a stat.
The OS I'm running on is Solaris-2.7 sparc, but might run the program
elsewhere. I'm willing to concede that not all OS's have an st_blocks
in their stat struct, but I'd like for it to be returned where it is.
--
Andy Steingruebl | e-mail: steingra at pprd.abbott.com
Unix Systems Admin/Programmer | phone: (847) 935-4728
Unix/Network Security | fax: (847) 935-0142
Abbott Laboratories, PPDR&D | post: 100 Abbott Park Road, D472 - AP9A
More information about the Python-list
mailing list