rsync include/exclude

gav on 2005-01-05T22:39:53

I'm a big fan of rsync and use it on a daily basis, but I just can't get my head around the include/exclude syntax. It seems to work in an opposite way to how I think. For example, to recursively find all files beginning with 'foo':

find . -name 'foo*'

But with rsync you can't really tell it what you want, just what you don't want and end up with this madness:

rsync --include='*/' --include='foo*' --exclude='*' . /dest


Maybe this?

Aristotle on 2005-01-05T23:27:27

find . -name 'foo*' -print0 | rsync --files-from - --from0