Transferring files using FTP from one server to another (recursively, command line)

Server & Network Configuration - NETCreator - 2018-01-10 09:35:30

Usually, when you buy a new server, when you upgrade to another kind of hosting, or when you change you web hosting provider, you need to transfer website's files, from your old server, to your new server.

How to transfer website's files to a new server

Most of the people are using FileZilla, or such a FTP Client to download all the files from the old server on their computer, and then upload the files to the new server. It's is simple to do this, but it could be a waste of time if your website has a lot of files, or if your server is located far away, because the transfer will take a longer time.

Very few know that they can transfer these files directly between servers, without an intermediary computer.

To do this, we will use ncFTP, as a command line FTP Client tool.

How to install ncFTP (Ubuntu and CentOS)

On the new server, we will need to install, a FTP Client Tool, named ncFTP.

Ubuntu/Debian

sudo apt-get update
sudo apt-get install ncftp

CentOS/Fedora/RHEL

sudo yum install ncftp

How to download files, using ncFTP

ncftpget -R -T -v -u "FTP USERNAME - OLD SERVER" FTP_DOMAIN_OLD_SERVER NEW_SERVER_DIRECTORY OLD_SERVER_FILES_DIRECTORY

Example:

ncftpget -R -T -v -u "john" ftp.example.com /home/john/public_html/example.com/ /home/public_html/

It will recursively download the files from OLD_SERVER_FILES_DIRECTORY folder on your old server, to NEW_SERVER_DIRECTORY folder, on your new server.

-R tells ncFTP to download all the files recursively;

-T says not to try a tar download (this solves the usually error "This does not look like a tar archive");

-v says to be verbose (it will show the download progress, download speed, and the file being downloaded);

-u is for the username.

After pressing [enter], you will be prompted for password.


Latest Posts
NETCreator CMS

Search
Free Hosting