Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

   *.gz
   *.gz.1
   *.gz.2
   *.gz.[0-99]

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*" –  Radoo 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. –  Radoo Feb 13 '13 at 21:04

1 Answer 1

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... :/ –  Radoo Feb 14 '13 at 18:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.