[patch] add "--ignore" option

Wayne Davison wayned at samba.org
Tue Feb 1 00:24:31 GMT 2005

On Mon, Jan 31, 2005 at 05:19:34PM -0000, Kirkwood, Matthew wrote:
> The patch below adds a "--ignore" option to rsync, which means
> "--exclude-but-dont-delete-even-if-we-specified--delete-excluded".

Firstly, let me compliment you on the patch -- it was very complete.
(Aside:  it helps to attach the patch instead of paste it into the
email to avoid line wrapping.)

One alternative to this new option is to have a separate set of excludes
for the sending side (which decides what files gets sent) and for the
receiving side (which decides what files get deleted) and then avoid
using --delete-excluded.

There is one way to do this if you use the CVS version:  specify the
rules in a per-directory merge file on each side, and then to avoid
sending that file:

    sender's .rsync-filter file:
	- *.no_send
	- *.no_send+no_delete

    receiver's .rsync-filter file:
	- *.no_delete
	- *.no_send+no_delete

    rsync -avFF --delete sender:/src/ dest:

The double -F option tells rsync to use any .rsync-filter files it finds
and to exclude them from the transfer (it is short for this filter
option:  --filter=":e /.rsync-filter").

An enhancement to make this possible without having to resort to per-
directory merge files would be to allow filter rules to be marked as
affecting just the sender or the receiver -- i.e. a rule that was marked
as sender-only would keep a file from being sent, but would not prevent
the file from being deleted on the receiver.  One way to do this would
be to add 's' & 'r' modifiers to the +/- filter rules, like this:

    -f "-s *.no_send" -f "-r *.no_delete" -f "- *.no_send+no_delete"

Something like that would be fairly easy to add.  What do you think?


More information about the rsync mailing list