Xref: utzoo comp.unix.ultrix:2056 comp.unix.questions:17260 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!snorkelwacker!spdcc!merk!xylogics!world!madd From: madd@world.std.com (jim frost) Newsgroups: comp.unix.ultrix,comp.unix.questions Subject: Re^2: Can ls show total Kbytes of "foo*"? Message-ID: <1989Oct28.181453.28177@world.std.com> Date: 28 Oct 89 18:14:53 GMT References: <1989Oct27.130914.12943@world.std.com> <2453@umbc3.UMBC.EDU> <4039@helios.ee.lbl.gov> Organization: Software Tool & Die Lines: 21 envbvs@epb2.lbl.gov (Brian V. Smith) writes: >In article <1989Oct27.130914.12943@world.std.com>, madd@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 \ 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@std.com +1 617-739-WRLD 24hrs {3,12,24}00bps