linux : 从服务器a上传文件到服务器b,不覆盖已存在的文件/ 跳过二者之间重复的内容

linux : 从服务器a上传文件到服务器b,不覆盖已存在的文件/ 跳过二者之间重复的内容

本地上传文件夹到服务器a

scp -r filename [email protected]:/home/demo/hhh_a

filename 要上传的文件夹
[email protected] 服务器a的名称和账号
/home/demo/hhh_a 要将文件夹上传到服务器a中的路径

服务器a 上传文件夹到 服务器b

  1. 服务器b是需要通过服务器a来跳板登陆:

    scp -r /home/demo/hhh_a  [email protected]:/disks/test/hhh_b
    
    /home/demo/hhh_a 要从服务器a中传到服务器b中的文件夹及其路径
    [email protected] 服务器b的名称和账号
    /disks/test/hhh_b 要将文件夹上传到服务器b中的路径
    
  2. 服务器b与服务器a之间无任何跳板关系(大部分是这种情况):

    scp -r [email protected]:/home/demo/hhh_a  [email protected]:/disks/test/hhh_b
    	
    
    [email protected] 服务器a的名称和账号
    [email protected] 服务器b的名称和账号
    /home/demo/hhh_a  要从服务器a中传到服务器b中的文件夹及其路径
    /disks/test/hhh_b 从服务器a中传来的文件夹在服务器b中的存放路径
    

服务器a 上传文件夹到 服务器b

只上传不重复的内容 / 跳过二者之间的重复内容

  rsync -avz --progress --ignore-existing [email protected]:/home/demo/hhh_a [email protected]:/disks/test/hhh_b

猜你喜欢

转载自blog.csdn.net/crist_meng/article/details/131434111