How do I make LFTP download a file from a remote server only if this file was created TODAY (the same day I run LFTP) ?
Use mirror
.
It has this --newer-than=SPEC
option to download only files newer than specified time. For your specific needs, use --newer-than=now-1days
. Now - 1 day should be yesterday therefore lftp will download all the file newer than yesterday.
Refer here for more info: http://lftp.yar.ru/lftp-man.html
EDIT: While I was tweaking my script, I notice there's an --only-newer
option which download only newer file which is also useful for your case but with slight changes. --only-newer
check the destination folder and download any files from source that's not in the destination folder while --newer-than
download any files that's newer than the time you specified without checking the destination folder.