Dotfiles, utilities, and other apparatus.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

17 lines
456 B

#!/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 }'