How to copy Files and Folder from one server to another server

If you want to copy a file / folder from one server to another, you can use wget or scp command. In this tutorial I will show how to use scp command to copy files / folder from one server to another.

Let us suppose

Server One IP is: 1.1.1.1
Server Two IP is: 2.2.2.2

How to copy a file

Suppose you want to copy a file from server one to server two.
Location of file on server one is: /home/filename.txt

Login to server two via SSH and run following command

scp root@1.1.1.1:/home/filename.txt /home/

This will copy filename.txt file from server one to server two and save in /home directory.

How to copy a folder / directory

Suppose you want to copy a complete folder from server one to server two.
Let’s say you want to copy /backup folder from server one to server two.

Login to server two via SSH and run following command

scp -r root@1.1.1.1:/backup /foldername

This will copy /backup directory from server one to server two and save in /foldername directory.

Our Top Rated Host

Related Posts