简体   繁体   English

如何在没有lftp的情况下重写bash脚本?

[英]How to rewrite bash script without lftp?

This is the script I have, it uses the lftp command. 这是我拥有的脚本,它使用lftp命令。 How can I rewrite that script so it does the same but does not use lftp? 我该如何重写该脚本,使其相同但不使用lftp? It would be great if a standard linux tool is used. 如果使用标准的linux工具,那就太好了。

#!/bin/bash
HOST=''
USER=''
PASS=''
TARGETFOLDER='/'
C_DIR=$(readlink -f .)
SOURCEFOLDER=$C_DIR'/exports'

lftp -f "
open $HOST
user $USER $PASS
lcd $SOURCEFOLDER
mirror --reverse --verbose --ignore-time --only-newer $SOURCEFOLDER         $TARGETFOLDER
bye
";
mv exports/*.xml exports/_exports_done/

Thanks for helping! 感谢您的帮助!

From link provided by Michael O. comment. 从Michael O.评论提供的链接。 How to recursively download a folder via FTP on Linux 如何在Linux上通过FTP递归下载文件夹

# command to test
wget -P "$TARGETFOLDER" -r -m --user="$USER" --password="$PASS" "ftp://$HOST/$SOURCEFOLDER"

EDIT: because of lftp --reverse option, the wget command should be executed on target server 编辑:由于lftp --reverse选项, wget命令应在目标服务器上执行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM