#! /bin/sh # This code is in the public domain # Written by Robbert Haarman usage="USAGE: $0 [-t time] [dir]" ### Defaults dir="$HOME/tmp" time=10080 ## Parse command line while [ $# -gt 0 ] do case "$1" in -t|--time) shift time="$1" ;; -d|--dir|--directory) shift dir="$1" ;; -h|--help) echo "$usage" exit ;; -*) echo "Unknown option: $1" >&2 echo "$usage" >&2 exit 128 ;; *) dir="$1" esac shift done find "$dir" -amin +"$time" -print0 | xargs -0 rm -fr