简体   繁体   中英

How to rewrite bash script without lftp?

This is the script I have, it uses the lftp command. How can I rewrite that script so it does the same but does not use lftp? It would be great if a standard linux tool is used.

#!/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. How to recursively download a folder via FTP on Linux

# 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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