FastNetMon

Wednesday, 16 January 2013

Важное замечание про указание путей в rsync excludes


if the pattern starts with a / then it is anchored to a particular spot in the hierarchy of files, other‐ wise it is matched against the end of the pathname. This is similar to a leading ^ in regular expressions. Thus "/foo" would match a name of "foo" at either the "root of the transfer" (for a global rule) or in the merge-file’s directory (for a per-directory rule). An unqualified "foo" would match a name of "foo" any‐ where in the tree because the algorithm is applied recursively from the top down; it behaves as if each path component gets a turn at being the end of the filename. Even the unanchored "sub/foo" would match at any point in the hierarchy where a "foo" was found within a directory named "sub". See the section on ANCHORING INCLUDE/EXCLUDE PATTERNS for a full discussion of how to specify a pattern that matches at the root of the transfer.
Суть в том, что если не указывать в excludes начальный слеш, совпадение будет не только с указанным компонентом, но и со вложенными папками, если такая будет внутри файловой иерархии!

2 comments :

  1. интересная багофича: --exclude="upload/" иногда не игнорит, а иногда игнорит. тогда как "upload/*" игнорит всегда. Во всяком случае, актуально в rsync 3.0.7-2 (дебиан 6.0.5)

    ReplyDelete
  2. planet, про это написано в документации :) Это - тоже фича!

    ReplyDelete

Note: only a member of this blog may post a comment.