Re^2: Can ls show total Kbytes of "foo*"?

jim frost madd at world.std.com
Sun Oct 29 05:14:53 AEST 1989


envbvs at epb2.lbl.gov (Brian V. Smith) writes:
>In article <1989Oct27.130914.12943 at world.std.com>, madd at world.std.com
>(jim frost) writes:
>< You could just do "wc -c foo* | tail -1".

>Try that on some LARGE files and you will quickly (slowly) see that
>"wc" is much slower than the "ls."

Ok, the following alias ought to work:

alias tsize "(cd $HOME ; echo '#include <sys/stat.h>\
main(argc,argv) int argc;char **argv;{int t=0;struct stat s;\
while(--argc){stat(*(++argv),&s);t+=s.st_size;}\
printf("%d",t);}' >foo.c ; cc -o foo foo.c) ; $HOME/foo"

A bit slow for those small jobs but if you're talking Gb files it'll
work great :-).

jim frost
software tool & die     "The World" Public Access Unix for the '90s
madd at std.com            +1 617-739-WRLD  24hrs {3,12,24}00bps



More information about the Comp.unix.questions mailing list