Portal Home > Knowledgebase > How-to > Hosting > File transfer between servers
In the article we will describe how to migrate data from one account to another. You will use rsync via SSH for such purpose. Firstly log in to your SSH account from which you want to transfer data.
Rsync uses the following format:
rsync OPTION SRC DEST
Where SRC is source data to transfer and DEST where it should be transfered.
If you have everything you want to transfer in one place, e.g. in ~/downloads and you want to transfer it into ~/downloads, only one command is required to do this.
Firstly start a new screen session:screen -dmS transfer
Now you go to this screen session:
screen -r transfer
Now use the following command to transfer files from downloads to another server:
rsync -auH --numeric-ids --progress --exclude=filezilla --exclude=watch --exclude=vpn --exclude=.htaccess -e ssh ~/downloads user@server.seedhost.eu:~/
Where the user is your username on the server where you want to transfer data and server.seedhost.eu is your destination server hostname. You will need to accept the ssh key and type in your password. Then it will start your data transfer.
To quit the screen session use CTR+A+CTR+D. If you want to go again into the screen session use the following command:screen -r transfer
When you finish transferring files, use the following command to terminate the screen session:screen -X -S transfer quit
The rsync command given above is for transferring files from downloads to downloads. Below we will provide some examples of transferring files from different SRC and to different DEST.
For example, you want to transfer something inside your downloads, but not the whole downloads directory, to downloads on the DEST server:rsync -auH --numeric-ids --progress --exclude=filezilla --exclude=watch --exclude=vpn --exclude=.htaccess -e ssh ~/downloads/FILES user@server.seedhost.eu:~/downloads
This command will transfer the folder FILES inside downloads to ~/downloads on the destination server.
If you want to transfer files from another provider which uses a different default downloads path, for example ~/data and you want to transfer it to our server and keep files seeding and keep the whole directory tree structure, you need to use:
rsync -auH --numeric-ids --progress --exclude=filezilla --exclude=watch --exclude=vpn --exclude=.htaccess -e ssh ~/data user@server.seedhost.eu:~/
If you want to transfer files from another provider who uses a different default downloads path, for example ~/data and you want to transfer everything that is inside this folder to our server into ~/downloads:
rsync -auH --numeric-ids --progress --exclude=filezilla --exclude=watch --exclude=vpn --exclude=.htaccess -e ssh ~/data/* user@server.seedhost.eu:~/downloads
For more information about rsync please refer to rsync help:
rsync -h
Add to Favourites Print this Article
Powered by WHMCompleteSolution