Can ls show total Kbytes of "foo*"?

Brian Miller brian at cvl.umd.edu
Sat Oct 28 06:51:40 AEST 1989


In article <2453 at umbc3.UMBC.EDU> rostamia at umbc3.UMBC.EDU (Rouben Rostamian) writes:
<I wonder if there is an obvious way to compute the total size of all
<"foo*" files in a directory.  The only way I know how is the ridiculously 
<complicated construction:
<
<ls -1s foo* | awk 'BEGIN{size=0} {size += $1} END{print "total: " size}'

Assuming everything equal (what am I saying...this is Unix), this
might work (at least it does for me)...

cat foo* | wc -c

Any typos are the responsibility of my cat.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Has anyone seen my old friend brain?
University of Merryland, Center for Automation Research
       -A nice place to live, but I wouldn't want to work there.



More information about the Comp.unix.questions mailing list