LINUX.ORG.RU
ФорумAdmin

rsync: правило exclude отменяет все include

 


1

1

rsync version 3.4.1 protocol version 32

Проблема:

rsync -vtR --include='*.txt'  --include='*.zip*' --include='*.rar*' --include='*.7z*' --exclude="*" source ~/dest/

Последнее правило отменяет все предыдущие. Пробовались также и фильтры, с тем же самым результатом:

rsync -vtR  --filter "+ *.txt" --filter "+ *.zip" --filter "+ *.rar" --filter "+ *.7z" --filter "- *" source ~/dest/

Приходится пока задействовать такую конструкцию:

for i in $( find source \( -iname "*.txt" -o -iname "*.zip" -o -iname "*.rar" -o -iname "*.7z" \) ) ; do rsync -vtR $i ~/dest/ ; done

Но довольно медленно… Хотелось бы rsync :(

А может порядок имеет значение? Пробовал --exclude засунуть в начало?

Выражение с find ужасно кривое, стоит наверное использовать -exec rsync {} + или как-то так.

Xenius ★★★★★
()
Последнее исправление: Xenius (всего исправлений: 1)

Учу в man rsync, дорого.

The  concept  path  exclusion  is  particularly  important when using a
       trailing ’*’ rule.  For instance, this won’t work:

              + /some/path/this-file-will-not-be-found
              + /file-is-included
              - *

       This fails because the parent directory "some" is excluded by  the  ’*’
       rule,  so  rsync  never  visits  any  of  the  files  in  the "some" or
       "some/path" directories.  One solution is to ask for all directories in
       the  hierarchy  to  be  included by using a single rule: "+ */" (put it
       somewhere   before   the   "-   *"   rule)
ну и так далее.

anc ★★★★★
()