re...@yahoo.co.uk wrote:
On Aug 13, 8:28 pm, Esmail <ebo...@hotmail.com> wrote:
Hi all,

Essentially all I want to know the size of a directory, and the size
of a zipped tarball so that I can compute/report the compression ratio.


     dir_size = os.popen('du -sk somename')
     data = dir_size.readlines()
     dir_size = int(data[0].split()[0])
     print 'dir size: ', dir_size


Hi,

 > Try using os.path.getsize(somename.tar.gz)

Beautiful! .. that takes care of the tarball .. but it doesn't seem to
work for reporting the total size of the directory. Any suggestions how
to do that in a nicer way?

I just looked through os.path.* and there doesn't seem to be a function
to report what "du -sb" would.

Thanks for your help,

Esmail

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to