[Zope] Size of a Folder
Antwan Reijnen
twanus@xs4all.nl
Fri, 01 Feb 2002 17:50:55 +0100
To achieve du-like behaviour, I guess it would be nice to recurse into sub-folders too :-) It should'nt be too hard either.
At 16:05 1-2-02 +0000, you wrote:
>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
> >
>
>
>_______________________________________________
>Zope maillist - Zope@zope.org
>http://lists.zope.org/mailman/listinfo/zope
>** No cross posts or HTML encoding! **
>(Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )