After experimenting with lftp I submit the solution using a bash script. So the contents of the bash script file will be
#!/bin/bash USER='username' PASS='password' HOST='ftp.mydomain.com' LOCAL_BACKUP_DIR='/backups' REMOTE_DIR='/backupfiles' lftp -u $USER,$PASS $HOST <<EOF set ftp:ssl-protect-data true set ftp:ssl-force true set ssl:verify-certificate no mirror -R -e "$LOCAL_BACKUP_DIR" "$REMOTE_DIR" quit EOF
When changing the first part with the appropriate parameters of your ftp host, this script will display a mirror of all the files in the local directory on the remote.
Since the remote host is a Windows IIS FTP server with a self-signed certificate configured, I should note the need for the set ssl:verify-certificate no in the script. In addition, although the IIS / FTP user must be entered in the form of HOST | USER, for example. ftp.mydomain.com | username, for some reason, if this is set in the USER lftp parameter, authentication fails. You have to omit the HOST name and just set the username ... and so it successfully connects.
source share