Recursively Download a directory via ftp

I will be using lftp instead of regular ftp. Since I would like to automate the process using cron, I will be using a script file for the list of commands.

First create the script file:

#cat ../dforcescript.lftp
open -u username,password
mirror backups ./

Here, I have specified that once logged in, the directory backups is to be mirrored to a directory backups in the current directory. The trailing / indicates that the directory name is to be recreated here.

Now execute lftp with:

#lftp -f ../dforcescript.lftp
---- Connecting to ( port 21
<--- 220 ProFTPD 1.3.3a Server ( [::ffff:]
<--- 230 User [email protected] logged in
<--- 250 CWD command successful