Is there a way to execute something only when a file is transferred with lftp mirror? This script runs with cron every minute, and it syncs a local folder with a remote FTP server. I want it to send an email only when a new file is detected and transferred, not when there is nothing to transfer. Right now it always sends an email.
HOST='xx.xx.xxx.xxx' USER='user' PASS='pass' TARGETFOLDER='/' SOURCEFOLDER='/' /opt/bin/lftp -f " open $HOST user $USER $PASS lcd $SOURCEFOLDER set xfer:log true set xfer:log-file "$LOGFILE" mirror --reverse --exclude @eaDir/ --exclude CloudStation/ --include .*\.mp3 -- bye " echo "New upload" | /opt/bin/nail -s "New upload" firstname.lastname@example.org