#!/bin/bash
#
#rsync -hav --exclude={'*.txt','dir3','dir4'} sourcedir/ destinationdir/
#
if [ $# -ne 2 ]
then
	echo "Use: backup-rsync pasta_origen pasta_destino"
	echo "Tente de novo!"
	exit 1
fi
#
if ! command -v rsync > /dev/null 2>&1
then
	echo "O programa rsync não esta instalado"
	echo "Instala o rsync e tente novamente!"
	exit 2
fi
#
current_date=$(date +%Y-%m-%d)
#
rsync_options="-havbrp --backup-dir $2/$current_date --delete --dry-run"
#
$(which rsync) $rsync_options $1 $2/current >> backup_$current_date.log
#
