Can ls show total Kbytes of "foo*"?
Rouben Rostamian
rostamia at umbc3.UMBC.EDU
Fri Oct 27 08:26:06 AEST 1989
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}'
(which I alias to something.) I run ULTRIX. The command "ls -s" in ULTRIX
lists the files in the current directory, gives the size of each file in
kilobytes, and also gives the total kilobytes for the files in that
directory.
It stands to reason to expect that the command "ls -s foo*" would provide
the corresponding information for all files "foo*" in the directory.
Alas, it does not work that way; although the size of each "foo*"
is displayed, the total kilobytes for the "foo*" files is not.
Am I missing something obvious?
--
Rouben Rostamian Phone: 301 455-2458
Department of Mathematics e-mail:
University of Maryland Baltimore County rostamian at umbc.bitnet
Baltimore, MD 21228 rostamian at umbc3.umbc.edu
More information about the Comp.unix.questions
mailing list