kj <no.em...@please.post> writes:
> I think you're missing the point.  The hook in question has to be
> called *immediately after* all the subtrees that are rooted in
> subdirectories contained in the current directory have been visited
> by os.walk.
> 
> I'd love to see your "5 lines" for *that*.

I'm having trouble understanding the specification.  To find the disk
usage (in bytes) of a directory:

import os,stat
def find_disk_usage(dirname):
  return sum(sum(os.stat(dirpath+'/'+filename)[stat.ST_SIZE]
                      for filename in fn_list)
              for dirpath, dirlist, fn_list in os.walk(dirname))

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

Reply via email to