[Tutor] df type function in python

Stuart Sears stuart at sjsears.com
Wed Jan 7 19:30:54 CET 2009


Redirecting to the list as I seem to have replied off-list rather 
inadvertently... <swears under his breath at Reply-To  and Return-Path 
headers...>

On 07/01/09 16:42, Spencer Parker wrote:
> I am looking for a function in python that would operate similar to df.
>   I would use df, but I am unable to parse the data that it gives me
> from there. If it would give me a single line I could then split it out
> if I needed to, but I can't see how to actually do that. What I am
> trying to do is get some information on a drive I have mounted. I have a
> disk image that I have mounted on temp folder that I need to see how
> much total pace it is taking up. It gives me a more accurate
> representation of my xen disk images that just an ls -sk or something on
> the file.

Which version of df do you have? Which OS is this on?

If you want one line per device/mountpoint, df -P will do so on linux 
systems nowadays. I have no idea whether any of this has been ported 
across to other *NIX systems.

Regards,

Stuart
-- 
Stuart Sears RHCA etc.
"It's today!" said Piglet.
"My favourite day," said Pooh.


More information about the Tutor mailing list