[net.wanted] how many blocks are how old?

bytebug@pertec.UUCP (roger long) (01/28/85)

Does anyone have any sort of utility that can be used on a filesystem
to give you a run-down on file/block aging?  I'd like to be able to
run it on, say, /usr/spool, to let me know how many blocks are one day
old, two days old, 30 days old, etc.

Something that gave other statistics of interest might be useful as well.
-- 
	roger long
	pertec computer corp
	{ucbvax!unisoft | scgvaxd | trwrb | felix}!pertec!bytebug

ron@brl-tgr.ARPA (Ron Natalie <ron>) (01/28/85)

> Does anyone have any sort of utility that can be used on a filesystem
> to give you a run-down on file/block aging?  I'd like to be able to
> run it on, say, /usr/spool, to let me know how many blocks are one day
> old, two days old, 30 days old, etc.
> 
	if [ -z "$1" ]
	then
		echo	Usage: ager days [dir]
		exit 1
	fi
	if [ $2x = x ]
	then
		DIR="."
	else
		DIR="$2"
	fi
	find "$DIR" -atime +$1 -exec ls -sd {} \; | awk \
		 "BEGIN { sum = 0 } \
		 { sum += \$1 } \
		 END { print sum }"