Copy or rsync command

前端 未结 8 1318
广开言路
广开言路 2021-01-30 03:42

The following command is working as expected...

cp -ur /home/abc/* /mnt/windowsabc/

Does rsync has any advantage over it? Is there a better way

8条回答
  •  借酒劲吻你
    2021-01-30 04:11

    if you are using cp doesn't save existing files when copying folders of the same name. Lets say you have this folders:

    /myFolder
      someTextFile.txt
    
    /someOtherFolder
      /myFolder
        wellHelloThere.txt
    

    Then you copy one over the other:

    cp /someOtherFolder/myFolder /myFolder
    

    result:

    /myFolder
      wellHelloThere.txt
    

    This is at least what happens on macOS and I wanted to preserve the diff files so I used rsync.

提交回复
热议问题