Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: lssum - summing up sizes of files



Quoting Bart Schaefer (schaefer@xxxxxxxxxxxxxxxx):
> 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.

I see.  Too bad.
And I keep wondering why "gls" doesn't aloow to "sum file sizes".
Doesn't everybody need this kind of thing every day?

> 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

Looks cool!  We have zsh-3.1.2 here - will that version work?
Or is are "modules" a new feature of zsh-3.1.4?
How do you "load" those modules, anyway?

> The manual is woefully short of examples; it's
> almost exclusively limited to descriptive text.

Indeed - the manuals need more examples.
Is there a good reason for not including them?
(Other than "minimal size"?)

Sven



Messages sorted by: Reverse Date, Date, Thread, Author