Selvakumar has asked for the wisdom of the Perl Monks concerning the following question:

How can we find complete folder size?

Replies are listed 'Best First'.
Re: How to find folder size
by davorg (Chancellor) on Jul 08, 2009 at 09:47 UTC

    -s returns the size of a file (even if that file is a directory). If you want to sum the sizes of the files within a directory then you'll probably want something like File::Find.

    --

    See the Copyright notice on my home node.

    Perl training courses

      or you can just parse output of du -csh <directory>
        Not very portable though - better to stick to davorg solution.
Re: How to find folder size
by Anonymous Monk on Jul 08, 2009 at 11:37 UTC
Re: How to find folder size
by boardryder (Novice) on Jul 08, 2009 at 18:55 UTC
    The way I've done it is for every file in each specified directory use the -s on the files and add them up. Here's a snippet of something similar I've done.

    ie.
    $size = 0; if (-f $var){ $size = -s $var; $dir_size =+ $size; }