[Tutor] Filesystem Usage

wesley chun wescpy at gmail.com
Fri Sep 22 08:03:56 CEST 2006


> How can I go about getting info similar to that which the UNIX df
> command provides - of filesystem usage and inode usage?  I could just
> shell out and run a df command, but I would rather use python
> bindings.

this sounds like it will require some work to implement 'df' in
Python, *and* it would be slower than its C counterpart.  rather than
just purely shelling out [with os.system() say], i'd use the one of
the {os,popen2}.popen*() functions or the subprocess module and
actually call 'df' but use Python to communicate with it (sending it
stuff via stdin and receiving output from it [stdout or stderr]).

hope this helps a little!
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
    http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com


More information about the Tutor mailing list