Getting file sizes
Jim Kuzdrall
gnhlug at intrel.com
Mon Oct 22 10:15:32 EDT 2007
On Monday 22 October 2007 09:36, Kent Johnson wrote:
> Jim Kuzdrall wrote:
> > On Monday 22 October 2007 09:11, Kent Johnson wrote:
> >> 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.
> >
> > Ah! Perhaps I actually know an answer to this one. (Very
> > rare)
> >
> > Go to directory of interest and try
> > du -shc *.txt
>
> That still lists each file individually, it needs to pipe to tail as
> Stephen suggested.
I thought of that, but you just said you wanted the answer. So I
gave you the engineering approach: simplest approximation of adequate
accuracy; minimum time spent. (It takes less than two seconds to
scroll the file names on the screen, and it does confirm what type of
files are being counted.)
However, next time I need that info (which I often do), I will try
to remember the "| tail -1" trick.
Jim Kuzdrall
More information about the gnhlug-discuss
mailing list