#!/bin/bash # # rsync files in the current directory ----> to the ones at www.pixture.com # # Usage: rputall # echo "-------------------------------------------------------------" echo "rsync-all: localhost ---> www.satotekkou.co.jp test site" echo -n "Recursive? : " # read 1 line from stdin read ans if [ -z $ans ] # Enter key then RECURSIVE="-r" elif [ $ans = 'y' ] || [ $ans = 'Y' ] then RECURSIVE="-r" elif [ $ans = 'n' ] || [ $ans = 'N' ] then RECURSIVE="" else echo -e "Invalid keyin.\\n\\n" ; exit fi echo -n "Test Run? : " # read 1 line from stdin read ans if [ -z $ans ] # Enter key then TESTRUN="" elif [ $ans = 'y' ] || [ $ans = 'Y' ] then TESTRUN="--dry-run" elif [ $ans = 'n' ] || [ $ans = 'N' ] then TESTRUN="" else echo -e "Invalid keyin.\\n\\n" ; exit fi echo -n "Delete (sync)? : " # read 1 line from stdin read ans if [ -z $ans ] # Enter key then DELETEMODE="" elif [ $ans = 'y' ] || [ $ans = 'Y' ] then DELETEMODE="--delete" elif [ $ans = 'n' ] || [ $ans = 'N' ] then DELETEMODE="" else echo -e "Invalid keyin.\\n\\n" ; exit fi echo "Starting..." echo "-------------------------------------------------------------" # -r recursive # -z compress transferring data # -l copy symbolic links as symbolic links # --stats show the statistics of operation at the end # --exclude=XXX exclude file/directory rsync -l $RECURSIVE -avz $TESTRUN $DELETEMODE --stats * www.satotekkou.co.jp:/www/html/sites/default/files/styles echo "Completed." echo