Re: Getting the total size of a directory

2004-01-05 Thread Randal L. Schwartz
> "Tim" == Tim Johnson <[EMAIL PROTECTED]> writes: Tim> find(sub{ -f and ( $size += -s ) }, $dir ); Beware that -s has only a rough correlation with the actual disk a file takes. You want (stat)[12] for that. The -s number will be far too huge for holey files (blocks aren't allocated), and

Re: Getting the total size of a directory

2004-01-05 Thread Rus Foster
On Sun, 4 Jan 2004 [EMAIL PROTECTED] wrote: > I'm running out of web space and want to write a script that tell me the size > of certain directories so I can see where the hog is. > > Can anyone give me some quick code? A shell script might be even faster with du -s /tmp | sort -n Rus -- e: [E

RE: Getting the total size of a directory

2004-01-04 Thread Tim Johnson
"Arching" google? I can't even remember what I was trying to say. Oh, well, that's what I get for CUI (coding under the influence). -Original Message- From: Tim Johnson Sent: Sunday, January 04, 2004 7:21 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Ge

RE: Getting the total size of a directory

2004-01-04 Thread Tim Johnson
I think there was a very recent thread on this, but here's one way using File::Find, taking a little from a result I found by arching Google: ## use File::Find; use strict; my $dir = $ARGV[0]; my $size; find(sub{ -f and ( $size += -s ) }, $dir ); $size = sprintf("