LFTP mirror upload only non existing files to remote directory
10,739
I don't have access to LFTP at the moment, but I suspect you're looking for the --only-missing
param, which is only usable with mirror
.
Try this:
lftp <<<EOF
open -u user,pass ftp2
mirror --reverse --only-newer $programa_dir/* /
bye
EOF
Related videos on Youtube
Author by
ispasov
Updated on September 18, 2022Comments
-
ispasov almost 2 years
Every 5 minutes some new files are downloaded via lftp to a local directory. I need to upload to another ftp only the non existing files. My script so far is:
#! /bin/bash today=$(date +%Y%m%d) today_files="rec."$today"_" programa_dir="/home/user/local-dir" # Download files, that do not exist in the local directory lftp <<EOF open -u user,pass ftp1 mget "$today_files*" -O $programa_dir bye EOF # Upload the files lftp <<EOF open -u user,pass ftp2 lcd $programa_dir mirror -R bye EOF
The mirror -R command doesn't recognize that only few files do not exist on the remote directory of the second ftp.
Is there a way to fix that? I need only to check the filename's , not the creation or the modification time of the files.
For the second ftp I tried
lftp <<EOF open -u user,pass ftp2 mput $programa_dir/* -O / bye EOF
The result was the same - lftp upload all the files, no only the non existing.
-
Toni about 9 yearsDoes -c option (continue) work (
mirror -R -c
)? Maybe it understands to "resume" previous mirror operation by adding only missing files.
-