I. on the same machine: 1. overwrite and copy files on centos. for example, cp-p-r-f & quot;/var & quot;/mnt/ubak/& quot) you can. However, if you use remote replication such as putty, the task should be stopped after the putty is interrupted, so the specific location of the replication cannot be determined. Later, we found that we used the following command nohup 1. on the same machine:
1. overwrite the copy
It is easy to copy files on centos using cp-p-r-f "/var" "/mnt/ubak/" (example. However, if you use remote replication such as putty, the task should be stopped after the putty is interrupted, so the specific location of the replication cannot be determined. Later, we found that the following command nohup cp-p-r-f "& Program will be executed in the background, and the execution will not be interrupted even if you exit the terminal.
2. do not overwrite the copy
Copy the song from/data/www/html/song/upload/m/to/mnt/backup/www/html/song/upload/m/without overwriting the same file.
(In fact, the system only prompts "no" by default for overwriting)
[Root @ localhost ~] # Awk 'In in {cmd = "cp-p-I-r/data/www/html/song/upload/m/*/mnt/backup/www/html/song/ upload/m /"; print "n" | cmd ;}'
2. on different machines:
Two methods
1. scp
Example: scp source dest // Copy source to dest
Different from cp, the source and dest forms here are as follows:
Username @ host name: file path
Example: scp root@202.112.23.12:/home/work/example. c. // Copy example. c on the remote machine 202.112.23.12 to the current directory of the local machine
Example: scp-r root@202.112.23.12:/home/work/project. // Copy the project directory on the remote machine 202.112.23.12 to the current directory on the local machine
Of course, you can also copy content from Machine A other than the local machine to machine B. enter the password of the two users on the two machines.
2. rsync
It is more powerful than scp and supports "not overwrite" original directory
Example: rsync-avz -- progress/root/client/root@202.112.23.12:/home/work/
// Copy the local/root/client/to the remote 202.112.23.12:/home/work/Directory. -- progress can view the copy process.
Example: rsync-avzu -- progress/root/client/root@202.112.23.12:/home/work /// u option, specify not to overwrite the original directory content
Example:
Copy files from the server with Port 11212 (non-default port 22)/m to the local folder
Rsync-avzur -- progress-e 'Ssh-p 100' root@192.168.50.11: /var/www/wwwroot/song/upload/m/*/data/www/html/song/upload/m/