FTP file transfer via command line could be very useful when dealing the the migration for large websites. Due to the amount of files it could be faster to move files server to server instead of downloading the files to your local machine and then uploading the files to the new server.
Follow this steps to migrate files from an old server (IP: 188.8.131.52 ) to a new server (IP: 184.108.40.206):
1- Connect to your new server via ssh as root user
2- Go to the path where you want to download your files. Example: cd /home/username/public_html
3- Connect to the old server FTP account using the following commands:
ftp> open 220.127.116.11
In the above example, you'd substitute 18.104.22.168 for the name of your domain or it's IP address you're wanting to connect.
Once connected, a username and password prompt will appear. Once these credentials have been entered, the server allows you to browse, send, or receive files depending on your rights.
4- List your current folder content using command:
ftp> lsThis command prints the names of the files and subdirectories in the current directory on the remote computer. You should find a folder called public_html. Inside this folder you will find files related to your website.
5- Go to directory public_html using command:
ftp> cd public_html
6- From this you can use the following commands to download files from the old server to your new server.
ftp> get index.phpDownloads the file index.php from the remote computer to the new server. Warning: If there already is file with the same name it will be overwritten.
ftp> put index.phpUploads the file index.php from the new server to the old server. Warning: If there already is file with the same name it will be overwritten.
ftp> mget *.jpgWith mget you can download multiple images. This command downloads all files that end with ".jgp".
ftp> mput *.jpgUploads all files that end with ".jgp".
ftp> mdelete *.jpgDeletes all files that end with ".jgp".
ftp> promptTurns iteractive mode on or off so that commands on multiple files are executed without user confirmation.
ftp> quitExits the ftp program.