Last active
August 29, 2015 14:28
-
-
Save facelordgists/0768928b36b58f199ba2 to your computer and use it in GitHub Desktop.
SFTP using LFTP w/ fancy options
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment