Discussion:
lftp mget exit code 1 when there are no files to retrieve
Rafael E. Martinez
2013-11-18 19:13:23 UTC
Permalink
Hi Alexander,

Just wanted to let you know that found something that you already replied
on and it seems do to the trick in my case as well by separating mget *.txt
with || echo -n, the script continues executing all the way to the end even
though mget return "no files found" and it finishes with exit code 0.

Thank you once again,

Rafael Martinez.

Reference script below. In case someone run into the same problem.

debug -o /cygdrive/C/LFTP/FTPlftp.log
set cmd:verify-host true
set cmd:verify-path true
set cmd:fail-exit true
set ftps:initial-prot P
set ftp:list-empty-ok true
set ftp:use-feat false
set ftp:ssl-allow false
set ftp:ssl-auth SSL
set ftp:use-allo false
set ftp:use-fxp false
set ftp:passive-mode true
set net:idle 1
set net:max-retries 9999
set net:reconnect-interval-base 2
set net:reconnect-interval-max 4
set net:timeout 120
set ssl:check-hostname true
set ssl:verify-certificate false
open -d ftp://USER:***@HOSTNAME:21
*mget *.txt || echo -n*
exit


On Mon, Nov 18, 2013 at 9:49 AM, Rafael E. Martinez
Hi Alexander,
Greetings and thank you for lftp. It is awesome.
I'm using lftp on Windows through Cygwin and it's been working great,
however, I running a script and when I go to retrieve files from the
server if there is no file the exit code of the program is 1 and I'm
relying on that code to make sure that an FTP connection was
established successfully.
The script is running on a schedule so if I didn't get files now, I
will get files later so I would like lftp to exit with code 0 even if
mget didn't retrieve any files.
Is there are way to allow the script to finish up with exit code 0
even though I didn't get any files?
Thank you in advance,
Rafael Martinez.
P.S. Not sure if this the correct way to post questions of if there is
an lftp forum. So I apologized if I have done it incorrectly.
Loading...