On Sun, 2009-10-04 at 00:29 +0400, rs...@xbit.ru wrote: > I'm trying to create a filter file for rsync what saying which dirs to > copy. For example i need only /lib and /var/lib dirs from remote server. > I say: > rsync -f ". /tmp/rsync_dirs" --dry-run --verbose "remote:/" > "/local_dir/". > > File /tmp/rsync_dirs looks like: > + /lib/ > + /var/ > -! /var/lib/* > - /* > > This doesnt work: it copies all /var/ dir except contents of /var/lib/. > What's wrong?
Your third rule excludes all files that don't match "/var/lib/*", and /var/lib is such a file since it has no third path component to match the "*". Hence the behavior you're seeing. Instead, try this approach of including the /var/lib dir and then excluding everything else at the /var/* level: + /lib/ + /var/ - /* + /var/lib/ - /var/* In practice, I have never found a legitimate use for "!" patterns and believe they are a misfeature. From the version-control history, it appears that the only use Wayne had in mind for them was to replace the traditional --include='*/' --exclude='*' (or --filter='S */' --filter='H *') pattern, but I really don't see what was wrong with that pattern, as it is consistent with the spirit of all other filter usage I have seen. Wayne, comments? -- Matt -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html