sh SFTP使用LFTP w / fancy选项

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh SFTP使用LFTP w / fancy选项相关的知识,希望对你有一定的参考价值。

#!/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}"

以上是关于sh SFTP使用LFTP w / fancy选项的主要内容,如果未能解决你的问题,请参考以下文章

带有密钥+密码的lftp [关闭]

Lftp+Sftp传输总结

linux下不同服务器间数据传输(rcp,scp,rsync,ftp,sftp,lftp,wget,curl)

sh lftp使用

sh 使用lftp将文件传输到ftp主机

Linux系统中使用lftp命令实现FTP上传下载