[Zope] Size of a Folder

seb bacon seb@jamkit.com
01 Feb 2002 16:05:54 +0000


On Fri, 2002-02-01 at 15:56, Gilles Lenfant wrote:
> Hi,
> 
> Is there a way to know the size of a ZODB Folder ?
> Something like "du somefolder" in UNIX ?

No, but it would be easy enough to write a python script which did it. 
This is a bit of a lazy way of doing it, and I've not tested it beyond a
quick go, but try something like:

##parameters=folder=None, size=0
##title=folder_size

if not folder:
    folder = context

for item in folder.objectValues():
    if hasattr(item, 'get_size'):
        size = size + item.get_size()
    size = size + item.folder_size(size=size)
    
return size

> 
> Thanks in advance !
> 
> --Gilles
>