FiReWaLL has asked for the wisdom of the Perl Monks concerning the following question:
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?$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); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Filesize counting recursive
by Crulx (Monk) on Jan 22, 2000 at 01:27 UTC | |
|
Re: Filesize counting recursive
by stephen (Priest) on Jan 22, 2000 at 14:32 UTC | |
by Crulx (Monk) on Jan 23, 2000 at 09:49 UTC | |
by chromatic (Archbishop) on Jan 23, 2000 at 10:30 UTC | |
|
Re: Filesize counting recursive
by FiReWaLL (Scribe) on Jan 22, 2000 at 21:56 UTC | |
|
RE: Filesize counting recursive
by Anonymous Monk on Jan 26, 2000 at 07:46 UTC | |
|
Re: Filesize counting recursive
by FiReWaLL (Scribe) on Jan 26, 2000 at 19:19 UTC | |
by vroom (His Eminence) on Jan 27, 2000 at 22:21 UTC | |
|
Re: Filesize counting recursive
by dlc (Acolyte) on Jan 25, 2000 at 00:38 UTC | |
by BBQ (Curate) on Jan 26, 2000 at 21:33 UTC |