Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am doing rsync copies between server. I'd like to exclude compressed log rotate files from the process. The files look like


I was unable to come up with rsync exclude pattern which would correctly perform the last condition in the list above (all files having .gz. in the name). Naive *.gz.* does not seem to work and files are copied. I also did not found out details about complex rsync exclude patterns.

Could someone point me to the right direction how to handle this case?

share|improve this question
Are you sure about "*.gz.*"? It's working fine on my OS X which should have the same rsync as most Linux platforms. Of course it will ignore the first one you have in your enumeration, as you don't have that point. You can always put "*.gz*" – user127350 Feb 13 '13 at 21:01
rsync doesn't seem to have an advanced regexp pattern matcher. It's the same case with grep, at least for grep there's the egrep alternative which flawlessly works with all regexps. – user127350 Feb 13 '13 at 21:04

I used the --exclude option to avoid copying the .gz.* files, with the following command and it works for me.

rsync -avr --exclude='*.gz.*' /source/path/ /destination/path/
share|improve this answer
He already said he uses exclude... :/ – user127350 Feb 14 '13 at 18:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .