Download all files from FTP server using lftp

lftp is a command line FTP client, that can be used to download all files from a remote FTP server to local folder.

This is useful when you want to move migrate site from one server to another.

To download all files from FTP server, create an empty folder and change to it.

mkdir ~/sok-move
cd ~/sok-move

Run lftp command to connect to remove FTP server.

lftp -u FTP_SERVER_USER,'FTP_SERVER_PW' FTP_SERVER_IP

This will connect you to FTP server. Run following 2 commands as needed. First command will disable SSL, this is required if remote FTP server have no SSL installed. Second command will enable active FTP mode, will be useful if passive FTP don’t work for you.

set ftp:ssl-allow false
set ftp:passive-mode off
set ssl:verify-certificate no

Change the folder that you need to download and run

mirror

This will download everything from remote FTP server to your local folder.

You can use options

mirror -c --parallel=10

Here -c is for continue, will help with resume if you get disconnected or want to mirror again.

–parallel=10 will tell lftp to download 8 files in parallel instead of files one by one.

See lftp

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *