将两个文件夹与rsync比较,并复制所有新内容和更改过的内容

时间:2020-01-15 16:25:46

标签: bash shell rsync

我有两个文件夹,其中的图像看起来像这样,它们中包含超过1GB的图像,因此只需将images_remote复制并替换为images_local会花费很长时间,我正在寻找一种更好的方法来处理此问题。

我正在寻找的是检查images_local与images_remote相比哪些内容已更改或丢失,并将其复制到images_local。

主要目标是使images_local与images_remote完全相同,而不必复制和替换所有内容。

文件夹结构看起来像这样

images_local                    
  image_1
    1.png
  image_2
    2.png

images_remote 
  image_1
    1.png
  image_2
    2.png
  image_3
    3.png

这是我现在所做的,它可以在某些方面起作用,但不能处理可能会从images_remote中删除或更改内容,然后“修复” images_local。

rsync -rvcm --compare-dest=/home/images_local/ /remote/images_remote/ /home/images_local/

0 个答案:

没有答案
相关问题