#!/bin/sh
# changed -- list recently changed files
#
# SYNOPSIS:  List files found in the given directories (default .),
# which have changed in the most recent N (default 0) days.
#
# AUTHOR:	Gary T. Leavens

[ -n "$echo" ] && set -x


USAGE="Usage: $0 -N [dir ...]"

# number of days, 0 = today
N=0

case "$1" in
-[0-9]*|+[0-9]*|[0-9]*)		# see documentation for "find"
	N="$1"
	shift
	;;
-*)
	echo "$USAGE" >&2
	exit 2
	;;
esac


if test $# = 0
then
	find . -type f -mtime $N -print | sed -e 's!\./!!' || exit 1
else
	# use each directory specified
	for d
	do
		find $d -type f -mtime $N -print || exit 1
	done
fi

exit 0
