http://www.perlmonks.org?node_id=204201


in reply to size of directory

Here's a dirsize method using File::Find.
#!/usr/bin/perl -w use File::Find; use strict; my $total = 0; my $dir = $ARGV[0] || '.'; find sub {$total += -s $_;},$dir; my $megs = sprintf "%5.2f",($total/(1024*1024)); print "Total size of files in $dir:$megs Mbytes\n";