# Creates mirror of the current directory using rsync
# Created: 2015.06.26
# Author: Kārlis Kalviškis <eko@lanet.lv>
# License: GPLv3

# For translation
export TEXTDOMAIN="karlo-scripts"
. gettext.sh


echo 
echo `eval_gettext 'Creates a mirror of the directory'` $(pwd)
echo `eval_gettext 'Be aware:'` `eval_gettext 'The non-existing files will be removed in the destination as well!!!'`
echo 

# Is there the destination?
if [ ! $2 ] ; then
	echo 
	echo `eval_gettext 'Missing parameters. Usage:'`
	echo $0 /`eval_gettext 'source'` /`eval_gettext 'destination'`
	echo 
	exit -1
fi

echo `eval_gettext 'Process the files? (Y/N)'`
while true; do
    read yn
    case $yn in
        [YyJj]* ) rsync -avzhe ssh --progress --delete $1 $2; break;;
        [Nn]* ) exit;;
        * ) echo `eval_gettext '(Y)es or (N)o?.'`;;
    esac
done


