Rysnc Backup Script

~/Desktop/bin/myRsync "Orange/Users/groggygarbad/Documents/databases2/" "TTD" "4GB-CARD"
#!/bin/sh
# DESTINATION USES SAME PATH AS SOURCE
# EXAMPLE: myRsync "Lemon/Users/GG5/Sites/" "ZapMap2" "Lexar"
# EXAMPLE: ~/Desktop/bin/myRsync "Orange/Users/groggygarbad/Documents/databases2/" "TTD" "4GB-CARD"

if [ $# -ne 3 ]; then
         echo 1>&3 Error, Usage: $0 sourcePath theDirectory destVolume
         exit 127
    fi

theDate=`date '+%y%m%d%H%M%S'`
theIncr="/Volumes/$3/$1/$2-$theDate"
theProg="/Volumes/$3/$1/progress.txt"
#theProg="/Volumes/$3/progress.txt"
echo "~/bin/myRsync"

echo "----------------------------------------------------------------------------------------" > "$theProg"
echo; echo; echo "/Volumes/$1$2 -> $theDate" >> "$theProg"
rsync -ablPvz --backup-dir="$theIncr" --delete --progress "/Volumes/$1$2/" "/Volumes/$3/$1/$2" >> "$theProg"
echo "---------------------------------------------------------------------------------------" >> "$theProg"

cat "$theProg"
exit

Leave a Reply

Your email address will not be published.