in reply to Filesize counting recursive
There's something funky about the above... it produced larger values than crulx's code for a couple of my directories, reason unknown. Seemed fairly accurate, though...use strict; use File::Recurse; MAIN: { my $dir = $ARGV[0]; my $size = 0; recurse(\&sum_size, $dir, \$size); print "Total size: $size\n"; } sub sum_size { my ($file, $total_size_ref) = @_; stat($file); unless (-d _) { $$total_size_ref += -s _; } 1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: Filesize counting recursive
by Crulx (Monk) on Jan 23, 2000 at 09:49 UTC | |
by chromatic (Archbishop) on Jan 23, 2000 at 10:30 UTC |