Today I am in big trouble I want to take emergency backup from client-server to another server, this is not actual problem main problem is the size of data and its more than 50 GB and I don’t want or any one don’t want to download and upload huge data from server to local machine and again on server.
I have found one solution to copy data from one server to another without downloading any file you just need SSH access of both server.
I am going to explain you Linux SCP command to copy file from remote server to local machine or on another server.
scp copies files between hosts on a network. It uses ssh for data transfer, and uses the same authentication and provides the same security as ssh. scp will ask for passwords or passphrases if they are needed for authentication.
[root@xxxxxxx public_html]# scp -r [email protected]:/home/userdirectory/public_html/upload/ .
scp -r
will copy your directory recursively.root
is the username of old server.xxx.xxx.xx.xx
this will be server IP address or you will also connect by using domain name.- After colon : you need to mention server static directory path which you need to copy.
- Last . (dot) use for current directory of new server, if you want to use another directory you need to mention static path of server directory.
if you check the option for SCP command you will get
-P port
Specifies the port to connect to on the remote host. Note that this option is written with a capital 'P', because -p is already reserved for preserving the times and modes of the file in rcp(1).
-p' Preserves modification times, access times, and modes from the original file.
-q' Quiet mode: disables the progress meter as well as warning and diagnostic messages from ssh(1).
-r' Recursively copy entire directories. Note that scp follows symbolic links encountered in the tree traversal.
-S program
Name of program to use for the encrypted connection. The program must understand ssh(1) options.
-v' Verbose mode. Causes scp and ssh(1) to print debugging messages about their progress. This is helpful in debugging connection, authentication, and configuration problems.
The scp utility exits 0 on success, and >0 if an error occurs.
if you want to exclude some files to copy on new server Linux scp command is the best way for you, if you want to all file without excluding any file from server then we have easiest way more than this it’s WGET. Read more about WGET.