in reply to looking for simple solution
Try this:
my $dir = "//home//schmoe//somedir"; my $dirsize = -s $dir || die "can't stat dir $dir: $!";
It should work. Any other ideas?
Update:
for those of us with real operating systems:
works just fine.`du -ks`
Update #2:
I found this in the Perl Cookbook, and made it a standalone bit of code:
#!/usr/bin/perl -w use strict; use File::Find; @ARGV = ('.') unless @ARGV; my $sum = 0; find sub { $sum += -s }, @ARGV; print "@ARGV contains $sum bytes\n";
This should be the ticket.
J. J. Horner Linux, Perl, Apache, Stronghold, Unix jhorner@knoxlug.org http://www.knoxlug.org/
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: looking for simple solution
by SuperCruncher (Pilgrim) on Jun 16, 2000 at 14:03 UTC |