excluding patterns from the --delete option?

jw schultz jw at pegasys.ws
Mon Mar 3 18:48:59 EST 2003


On Sun, Mar 02, 2003 at 11:30:16PM -0800, Mason Lee wrote:
>   Please could someone tell me if it is possible to specify in a single 
> rsync command that the --delete option should apply to all files except 
> those matching a certain pattern?  I want to do a -a archive, except 
> that a few directories should not have --delete applied.  Do I need to 
> use two rsync commands to achieve this?

You have three choices: don't delete, --delete,
--delete-excluded.

What you describe would require two passes.  Use --delete
with an exclude list in the first pass and then run without
the --delete option dropping the files you wanted to keep
from the exclude list.  The second pass can be a bit faster
if you use an include/exclude list that only evaluates the
files you previously excluded.  Since you are talking whole
directories it should be fairly easy to partition the
problem.

Generally files and directories that require special
handling should be isolated from the rest so that their
treatment is not special.



-- 
________________________________________________________________
	J.W. Schultz            Pegasystems Technologies
	email address:		jw at pegasys.ws

		Remember Cernan and Schmitt


More information about the rsync mailing list