[Tutor] Looking for something similar to du...

Alan Gauld alan.gauld at btinternet.com
Tue May 6 02:21:21 CEST 2008


"Spencer Parker" <inthefridge at gmail.com> wrote

>I am wondering if there is a way to do something that du does in 
>Linux.  I
> have several disk images and I need a way to get the size used...not 
> the
> size of the image.  If you type in du and the disk image path it 
> gives you
> this number.  is there anyway to do this in python?

Probably but I'm not totally clear what you are looking for.
Can you explain what you mean by the diffrence between the size
used versus the size of the image? Surely the size of the image
is the space it uses? Or are you expanding compressed files?

Can you give an example of the two measures so that we(I?) can
better understand the distinction

Meantime try looking at the os.walk function and the os.fstat 
function.
That may be all you need.


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld





More information about the Tutor mailing list