From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29274 invoked from network); 13 Jun 1998 17:12:34 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 13 Jun 1998 17:12:34 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id NAA15024; Sat, 13 Jun 1998 13:06:03 -0400 (EDT) Resent-Date: Sat, 13 Jun 1998 13:05:50 -0400 (EDT) From: "Bart Schaefer" Message-Id: <980613100641.ZM27081@candle.brasslantern.com> Date: Sat, 13 Jun 1998 10:06:41 -0700 In-Reply-To: <19980613181013.A4302@math.fu-berlin.de> Comments: In reply to Sven Guckes "lssum - summing up sizes of files" (Jun 13, 6:10pm) References: <19980613181013.A4302@math.fu-berlin.de> X-Mailer: Z-Mail (5.0.0 30July97) To: Sven Guckes , zsh-users@math.gatech.edu Subject: Re: lssum - summing up sizes of files MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"CKb61.0.Cg3.i5hWr"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1603 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Jun 13, 6:10pm, Sven Guckes wrote: } Subject: lssum - summing up sizes of files } } Does anyone have a nice and small function to sum up the sizes of files? } I just hope this isn't a standard example in the zsh manuals - yet. } but I think it should be. ;-) The manual is woefully short of examples; it's almost exclusively limited to descriptive text. In any case, in 3.1.4 with the "stat" module loaded, you can do it with sumsizes() { local sum sizes i stat -A sizes +size $* sum=0; for i in $sizes; ((sum += i)) print sum } E.g. sumsizes **/*.o Replace +size with +block if you want the actual disk block usage. In 3.0, there's no direct way to read the size of the file into the shell. You'd have to run "ls" and parse the output, or something. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com