$directory = '/thedir/thatiwantto/count';
print "\n\n";
print CountSize($directory);
print "\n\n";
sub CountSize {
my ($directory) = $_[0];
my ($ask, $filesize, $item, $size, @raiz);
@raiz = glob("$directory/*.*") || warn();
foreach $item (@raiz) {
$ask = -d $item;
if ($ask) {
$size += &CountSize($item);
} else {
$size += -s $item;
}
}
return($size);
}
It should return the total size of all the tree. In Windows, it works, but in Linux, it doesn't. It returns only the current directory file sizes. What should I do?
Originally posted as a Categorized Question.