include/exclude patterns to copy just certain files?
Bob Proulx
bob at proulx.com
Thu Jul 8 05:31:05 GMT 2004
Wayne Davison wrote:
> Bob Proulx wrote:
> > rsync -a --include '*/' --include '**/a1/foo' --exclude "*" . example.com:/tmp/
>
> Yes, that is the way to use include/exclude without first figuring
> out where all the foo files are. As you noted that results in all
> directories in the tree being created.
Darn.
> The easiest way around this is to switch from include/exclude to using
> the --files-from option, like this:
>
> find . -name foo | rsync -a --files-from=- . example.com:/tmp/
Yes! That is exactly what I want. I see that it is a new option. I
had not noticed its arrival. In fact I needed to upgrade to get it.
I really think that is a good design direction. Keep all of the file
finding tasks in 'find' and use it to drive rsync. A nice modular
approach that follows the traditional UNIX philosophy. I like it!
As an enhancement I would really like it even more if the --from0
option could be combined with --files-from to be --files-from0. It is
more compact and has a similar style to find's --print0 option.
Although I will probably use -av0 with this more often than anything
else so this is not a big deal.
Thank you for pointing me to that option. It works great.
Bob
More information about the rsync
mailing list