Getting file sizes
Stephen Ryan
stephen at sryanfamily.info
Mon Oct 22 09:18:38 EDT 2007
On Mon, 2007-10-22 at 09:11 -0400, Kent Johnson wrote:
> Newbie question:
>
> How can I get the total size, in K, of all files in a directory that
> match a pattern?
>
> For example, I have a dir with ~5000 files, I would like to know the
> total size of the ~1000 files matching *.txt.
>
du -c *.txt | tail -1
(That's "-(one)", not "-(ell)", meaning, you only want the last line of
output from du.)
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.
--
Stephen Ryan
Dartware, LLC
More information about the gnhlug-discuss
mailing list