--include-from question

A.Weston alweston at newscene.com
Wed Feb 9 22:32:23 GMT 2005


I'm having problems using rsync's --include-from and --exclude-from 
options.

Here's an example of what I'm trying to do:

On the source machine I have /usr/local/bin, /usr/local/etc, and 
/usr/local/foobar. I only want to sync /usr/local/bin and /usr/local/etc.

Things work as expected if I use the following rsync command:

    rsync -av --exclude-from=exclude.txt source:/usr/local dest:/usr

exclude.txt contains:
+ /local/bin/
+ /local/etc/
- /local/foobar

The only problem is somebody might create a new directory under 
/usr/local/ and unless I manually add it to the list in exclude.txt, 
rsync will sync this new directory. I don't want that to happen.

So I tried creating a list of files to be included, and used the 
following rsync command:

    rsync -av --include-from=include.txt source:/usr/local dest:/usr

include.txt contains:
+ /local/bin/
+ /local/etc/
- *

I figured this would get the bin and etc directories I want and exclude 
everything else, but it's not working. The rsync man page suggests 
adding specific fules for all the parent dirs. So I added + /local/. 
That didn't work. I also tried adding + */ before the -* but that didn't 
work either.

I'm stuck as to why the include version won't work. Any ideas?

 --
Al Weston





More information about the rsync mailing list