As I've said before, using perl as a shell script language is not really the best use of perl, nor your CPU. Especially when the pure-perl solutions can be just as fast (or faster) and easier to get right.
Check out cog's module, Filesys::DiskUsage. It can do this much more simply, and much more perlishly.
use Filesys::DiskUsage qw/du/; my $fullpath = '/tmp/dir*'; my $sum = du({'sector-size' => 4096, 'symlink-size' => 4096}, glob $fu +llpath);
I'm using a size of 4096 above as that seems to be a normal size nowadays for some reason. If you want the individual entries' sizes, you can also pass in 'make-hash' => 1 as an option in the hashref of options. Then the answers should come back in a hash where the key is the file/directory, and the value is the size.
In reply to Re: Capturing shell command error
by Tanktalus
in thread Capturing shell command error
by kulls
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |