8 # copyright Colin Patrick McCabe, 2011
18 echo "$0: archives old files"
20 echo "-c copy the file rather than moving it"
21 echo "-d <dir> directory where the file should end up (default: .)"
22 echo "-h This help message"
28 while getopts "cd:h" flag
45 if [ $copy -eq 1 ]; then
51 [ -d "$destdir" ] || die "destdir '$destdir' is not a directory"
54 [ -e "$file" ] || die "'$file' does not exist"
57 new_file_name=$destdir/`date +'%Y-%m-%d'`_`basename $file`
58 $cmd "${file}" "${new_file_name}" || die "failed on $file"