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/bashtoday=$(date +%Y%m%d)today_files=rec.$today_programa_dir=/home/user/local-dir# Download files, that do not exist in the local directorylftp <<EOFopen -u user,pass ftp1mget $today_files* -O $programa_dirbyeEOF# Upload the fileslftp <<EOFopen -u user,pass ftp2lcd $programa_dirmirror -RbyeEOFThe 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 <<EOFopen -u user,pass ftp2mput $programa_dir/* -O /byeEOFThe result was the same - lftp upload all the files, no only the non existing.
LFTP mirror upload only non existing files to remote directory
bash;shell script;ftp;lftp
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 <<<EOFopen -u user,pass ftp2mirror --reverse --only-newer $programa_dir/* /byeEOF