use File::Find; my $TOP = "/some/place/out/there"; my %sums; find sub { my @places = split qr{/}, $File::Find::name; my $blocks = (stat($_))[12]; while (@places) { $sums{join "/", @places} += $blocks; pop @places; } }, $TOP; # now $sums{"/some/place/out/there/foo"} contains the aggregate sum of + all blocks below that directory!
|
|---|