rsync - сравните-dest не работает

У меня есть эти каталоги SRC, DST, COMPARE:

  • /opt/SRC

    file1
    file2
    file3
    
  • /opt/DST

    file1
    file2
    
  • /opt/COMPARE

    пустой

Хотелось бы:

$ ls /opt/COMPARE
file3

Но когда я работаю:

rsync -avz --compare-dest=/opt/COMPARE /opt/SRC/ /opt/DST

/opt/COMPARE каталог все еще пуст, почему?

0
задан 29 April 2019 в 20:14

1 ответ

Я считаю, что вы применяете --compare-dest неправильно.

Из man rsync

   --compare-dest=DIR
          This option instructs rsync to use DIR on the destination machine as an  additional
          hierarchy  to  compare  destination files against doing transfers (if the files are
          missing in the destination directory).  If a file is found in DIR that is identical
          to  the  sender’s  file, the file will NOT be transferred to the destination direc‐
          tory.  This is useful for creating a sparse backup of just files that have  changed
          from  an  earlier  backup.  This option is typically used to copy into an empty (or
          newly created) directory.

         Beginning in version 2.6.4, multiple --compare-dest directories  may  be  provided,
          which  will  cause  rsync  to  search  the list in the order specified for an exact
          match.  If a match is found that differs only in attributes, a local copy  is  made
          and  the attributes updated.  If a match is not found, a basis file from one of the
          DIRs will be selected to try to speed up the transfer.

         If DIR is a relative path, it is relative to the destination directory.   See  also
          --copy-dest and --link-dest.

         NOTE:  beginning with version 3.1.0, rsync will remove a file from a non-empty des‐
          tination hierarchy if an exact match is found in one of  the  compare-dest  hierar‐
          chies (making the end result more closely match a fresh copy).

Если я правильно читаю, --compare-dest используется для остановки отправки определенных файлов. Это позволит вам создать новый каталог назначения копирования, содержащий только файлы, которые изменились с момента последней копии. Сортируйте инкрементную копию, если хотите.

0
ответ дан 29 April 2019 в 20:14

Другие вопросы по тегам:

Похожие вопросы: