note
mikeirw
<p>If you're wanting to sum the sizes of all files within a directory, this should do it:</p>
<code>
my $dir = '/path/to/dir';
my $dir_size = 0;
my $file;
opendir DIR, $dir or die "Unable to open $dir: $!\n";
$dir_size += -s "$dir/$file" while defined( $file = readdir DIR );
closedir DIR;
print $dir_size;
</code>
<p> This does not descend into subdirectories, though.</p>
204104
204104