Informational Website publish

Blog

News about our company, tutorials about IT and much more you will find in this page.

How to Copy Files / Folder from One Server to Another

Janeiro 30th, 2018

If you want to copy a file / folder from one server to another, you can use the wget or scp command. In this tutorial I will show you how to use the 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 the file on server one is: /home/filename.txt

Login to server two via SSH and run the 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 it 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 the following command:

scp -r root@1.1.1.1:/backup /foldername

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