#!/bin/sh # findsize - get size in Kb (I think) for a given name pattern to find(1). # # USAGE: # # findsize "*.jpg" # # find(1) options: # -iname "$1" does a case-insensitive name search for the pattern in $1 # -print0 spits out null-delimited strings # # du(1) options: # -BK sets block size # --files0-from=- reads null-delimited filenames from stdin find . -iname "$1" -print0 | du -BK --files0-from=- | awk '{ a += $1 } END { print a }'