Recursive download from shared hosting FTP

IBM Thinkpad r40 BIOS upgrade process with Grub4DOS and other useful links.

Posted on November 06, 2013 and updated on May 29, 2014

WARNING: Please note that this article was published a long time ago. The information contained might be outdated.

Recently I needed to migrate a WordPress website from a shared hosting provider to to a virtual private server. More than 4GB of data to transfer to my computer and to re-upload to the new server. So I started looking for a way to do a recursive FTP download directly on the new server.

I first tried to use wget:

wget -N -r --ftp-user=USERNAME --ftp-password=PASSWORD ftp://ftp.example.com/com.example/

but wget wasn't able to download all the files, the ones under the com.example/wp-content/blogs.dir/ (all the subdirectories were there but no files).

So I tried the less common lftp:

lftp -u USERNAME,PASSWORD -e 'mirror /com.example/' ftp.example.com
lftp was able to download everything, also .htaccess files. This is the official lftp website: http://lftp.yar.ru/

Update 2014-05-29

If you get an error like "mirror: Fatal error: Certificate verification: Not trusted", add

set ssl:verify-certificate no

to the ~/.lftp/rc file. Thanks to http://anils-tips.blogspot.it/2011/05/lftp-fatal-error-certificate.html for this tip!