shell script to make date stamped backup copies
#!/bin/sh
#
# make standard-ish datestamped backup copies of files
# getopts: see "Learning the Korn Shell 2nd ed" 6.1.3 getopts
#
DT=`date +"%Y%m%d"`
VERBOSE=0
while getopts "tv" opt; do
case $opt in
t ) DT=`date +"%Y%m%d.%H%M"` ;;
v ) VERBOSE=1 ;;
\? ) echo 'usage: bcp [-t] args ...'; exit 1;;
esac
done
shift $(($OPTIND - 1))
for F in $* ; do
if [ "$VERBOSE" = "1" ] ; then echo "cp $F $F.$DT" ; fi
cp $F $F.$DT
done
date: 08/10/2007
|