[Zope] total size of files in a folder

Marcus Bergmann zope@zope.org
Wed, 27 Feb 2002 13:23:03 +0100


"Cornelis J. de Brabander" wrote:
> 
> Your total_size is initialized for each element of your objectValues list.
> I would use "REQUEST.set('total_size'=total_size+size)"
> cheers
> 
> Cornelis J. de Brabander
> >

Thanks, but I dont understand what peace of my code I have to change.
Try and error gave me no success.

Marcus

> >
> > Hi,
> >
> > I want to get the total size of a folder. I do a loop over all files in
> > the folder, but it gives me only the size of the last file in the
> > folder:
> >
> > <dtml-let total_size="0">
> >  <dtml-in "Files.objectValues()">     #Files is the name of my folder
> >   <dtml-let total_size="total_size+size">
> >    <dtml-if sequence-end>
> >     <dtml-var total_size>
> >    </dtml-if>
> >   </dtml-let>
> >  </dtml-in>
> > </dtml-let>
> >
> > Alternatively, is there simply a variable I can lookup to get the size
> > of the folder?
> >
> > Thank you,
> > Marcus