Kent Johnson <[EMAIL PROTECTED]> writes: > Newbie question: > > How can I get the total size, in K, of all files in a directory that > match a pattern?
Stephen Ryan <[EMAIL PROTECTED]> writes: > du -c *.txt | tail -1 > > du prints out the sizes of each of the matching files; '-c' means you > want a total, too; piping the output through tail -1 picks out just the > last line with the total. Hmmm, I wouldn't have chosen 'tail -1'. My instinct would have been to 'grep -i total', which is both more typing, and not as accurate (what if there was a filename containing the string 'total'?). "Michael ODonnell" <[EMAIL PROTECTED]> writes: > du -c -h --files0-from=<(find . -xdev -type f -name "*.jpg" -print0 \ > 2>/dev/null) | tail -1 Hmm, again, certainly not my fist instinct :) I almost *never* think to redirect stdin this way for some reason. Had I come up with the answer, I probably would have written it more like: find . -type f -name \*.muse -print0 | du -c --files0-from=- | tail -1 Which yields the same answer. I think I like mod's better :) Ted Roche <[EMAIL PROTECTED]> writes: > To get the result in K, specify: > > du -c --block-size=1024 *.txt Hmmm, I would have just used -k, or actually, let it default to that and not specify any flag at all regarding size. > or your choice of what you think K means ;) Though, it's very cool that you can specify exactly what you mean here. > man du tells more. Indeed it does! What a great little thread! :) -- Seeya, Paul _______________________________________________ gnhlug-discuss mailing list gnhlug-discuss@mail.gnhlug.org http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/