[CentOS] rsync reply

Fri Jul 28 16:53:22 UTC 2006
Mark Schoonover <schoon at amgt.com>

Melinda Odom wrote:
> Hi,
> 
>>>>>>>>>>>> 
> What part of the '--exclude=[PATTERN]' part of the man page is giving
> you trouble? Is something not matching correctly, overmatching too
> much or...?
>>>>>>>>>>>> 
> 
> I don't understand how to write it. I have rsync 2.5.7
> 
> These don't work:
> rsync -av --delete '--exclude=[cache]'  -e ssh
> rsync -av --delete '--exclude=cache'  -e ssh
> rsync -av --delete --exclude='cache' -e ssh
> In fact nothing with the = sign works.
> 
> Could you please give an example of the code in you want to remove
> these folders listed as:
> root
> 	cache
> 	download
> 
> 	shop
> 		cache
> 		download

Put these in a file - excludes.list

/cache
/download
/shop/cache
/shop/download

Your rsync command will look like this:

rysnc -av --delete --exclude-from=excludes.list -e ssh ... The
-excludes=PATTERN would work with --excludes=file.*, etc... There's also the
--dry-run option that will output what rsync will be transferring. You can
test things that way without actually rsyncing files.

HTH

Mark