awk help needed

William Park opengeometry-FFYn/CNdgSA at
Mon Jul 20 03:34:09 UTC 2009

On Sun, Jul 19, 2009 at 12:27:22PM -0400, Giles Orr wrote:
> I would love to use "du" because initially it seems like precisely the
> right tool ... but I want only the sum of the sizes of the files in
> the current directory, and "du" is by default recursive (which also
> makes it painfully slow to return, not a good thing for something
> incorporated into a Bash prompt).  If it's possible to stop "du" from
> recursing, I'll use it immediately - but that looks difficult to
> impossible.  Any thoughts?

1.  (find -type f -maxdepth 1 -mindepth 1 -printf '%s+'; echo 0) | bc
2.  $(( $(find -type f -maxdepth 1 -mindepth 1 -printf '%s+') 0 ))

You can use '%k' and '%b' to get disk space in 1024 and 512 bytes.

William Park <opengeometry-FFYn/CNdgSA at>
The Toronto Linux Users Group.      Meetings:
TLUG requests: Linux topics, No HTML, wrap text below 80 columns

More information about the Legacy mailing list