#!/bin/bash
LOGFILE=/path/to/your/log/file.log
REMOTE=/path/to/remote/dir/
LOCAL=/path/to/local/dir
REMOTEIP=x.x.x.x
USERNAME=x.x.x.x
PORT=xxx
echo “CP remote dirs to local START at `date +%Y%m%d-%H:%M:%S`“ >> $LOGFILE
scp -rv -P $PORT $USERNAMEt@$REMOTEIP:$REMOTE`date +%Y%m%d` $LOCAL
echo “CP remote dirs to local END at `date +%Y%m%d-%H:%M:%S`“ >> $LOGFILE