Simple bash script to copy files via SCP

This can be used for example to retrieve a copy of one’s website, blog, or other files on a script or cron job. You will need to have your SSH identity files for passwordless login.

#-- start config
# Local Directory for backups. A date-specific folder is created under this directory for the files.
# Remote Directory to retrieve. Files are retrieved recursively starting here. Hidden files are included.
# Must be full path, don't use ~ shortcut.
# Path to SSH ID file (private key)
# USERname to login as
# HOST to login to
#--- end config

BD="$LD/`date +%F`"
mkdir $BD
scp -ri $ID [email protected]$HOST:$RD/. $BD