SFTP using LFTP w/ fancy options
#!/bin/bash
# usage:
# sh get-directory-via-sftp.sh hostname:port username password source_folder destination_folder
# sh get-directory-via-sftp.sh example.com:2222 awesome_user Ultra-pw-9000 /remote-folder-name ~/Downloads/
# This will copy /remote-folder-name to ~/Downloads/remote-folder-name
HOST=$1
USER=$2
PASS=$3
SOURCE=$4
DESTINATION=$5
lftp -c "open sftp://${HOST}
user ${USER} ${PASS}
set net:reconnect-interval-base 2
set net:reconnect-interval-max 2
set net:max-retries 1
set cache:enable
set mirror:use-pget-n 10
mirror --verbose ${SOURCE} ${DESTINATION}"
#!/bin/bash
# usage:
# sh get-directory-via-sftp.sh hostname username password source_folder destination_folder
# sh get-directory-via-sftp.sh example.com:2222 awesome_user Ultra-pw-9000 ~/Downloads/folder-name /wp-content/plugins/
# This will copy ~/Downloads/folder-name to /wp-content/plugins/folder-name
HOST=$1
USER=$2
PASS=$3
SOURCE=$4
DESTINATION=$5
lftp -c "open sftp://${HOST}
user ${USER} ${PASS}
set net:reconnect-interval-base 2
set net:reconnect-interval-max 2
set net:max-retries 1
set cache:enable
set mirror:use-pget-n 10
mirror --reverse --verbose ${SOURCE} ${DESTINATION}"