in reply to How do I recursively count file sizes in a script that works under both Windows and Linux?

File::Find is part of the standard distro, reliable and portable.

use File::Find; my $dir = 'c:/test'; my $size = 0; find( \&size, $dir ); sub size { # we get each filename in $_ my $file_size = -s $_; $size += $file_size; print "Found $_ $file_size Bytes\n"; } print "$size Bytes in '$dir' and all subdirs\n";
  • Comment on Re: How do I recursively count file sizes in a script that works under both Windows and Linux?
  • Download Code