filtered --delete ?
corey at bitworthy.net
Mon Jun 23 17:50:44 GMT 2008
On Monday 23 June 2008 11:55:59 pm Matt McCutchen wrote:
> On Mon, 2008-06-23 at 15:05 +0000, Corey wrote:
> > Is there any way of filtering which files --delete removes?
> > ...something like a --delete-exclude=FILTER option or something
> > equivalent?
> This is exactly what "protect" filters (--filter='P pattern') do.
Ah - nice, I had overlooked that while perusing the man page; too much
in a hurry for my own good!
> Actually, by default, a plain exclude like --exclude=pattern or
> --filter='- pattern' both "hides" matching source files from the file
> list and "protects" matching destination files from deletion. With
> --delete-excluded, plain excludes only hide and you have to use
> --filter='P pattern' to protect.
> > I want to do an rsync on multiple directories, however I only want one of
> > these directories to have files deleted, or I only want certain specific
> > files deleted, not all of them - is this possible?
> Do something like --filter='R /delete/in/D/*' --filter='P *'. The "R"
> is for "risk", the opposite of "protect". Files in directory D will
> match the first filter and be considered for deletion, while all other
> files will match the second and be protected from deletion.
Excellent; thanks a ton - that's exactly what I was looking for.
More information about the rsync