include exclude help please.

Wayne Davison wayned at
Wed Mar 20 06:55:50 EST 2002

Seems to me that the simplest solution is to name the directory

rsync -a --include "*/" --include "*.tif" --exclude "*" /film/jonah /tmp/film

To accomplish the same thing using includes, you could do this:

rsync -a --include /jonah --include "/jonah/**/" --include "*.tif" \
         --exclude "*" /film/ /tmp/film

If you want to exclude any empty directories that either of these
commands creates, you'll have to be more specific in the directory path
that is allowed to succeed.  I.e., if there's a "foo/bar" path inbetween
jonah and sourceimages, you'd need to do something like this:

rsync -a --include /jonah --include /jonah/foo --include /jonah/foo/bar \
         --include /jonah/foo/bar/sourceimages --include "*.tif" \
	 --exclude "*" /film/ /tmp/film

I haven't tested any of these, but they look right to me.


More information about the rsync mailing list