Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a problem with rsync: either it shows me all files in the directories I am rsyncing (if using the flag -v) or nothing at all (when not using -v).

I would like to have rsync quiet except for the files which actually had to be uploaded to the far end. Is there a flag to activate this kind of reporting? I can not find this in the documentation

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

Yes, check out the -i flag. It gives a report of every operation in a cryptic format. See the man page for the exact definition of the format.

In order to get the list of files which are sent to the remote host, you could use the following:

rsync <options> -i <src> <dst> | grep '^<' | awk '{ print $2 }'
share|improve this answer
1  
This is reporting again all files, not the changed ones. –  jeckyll2hide Jun 22 '12 at 7:33
    
@gonvaled No, only the files which are sent to the remote host are output (as <fcstpoguax filename, where the different flags show why they need to be updated). If it reports all files, something may be wrong with your test or your environment. –  Oliver Jun 22 '12 at 7:41
    
I think you are right. I have taken a look at the manpage and it is described as you say. But my system is reporting all files. Maybe something wrong with the far-end ... –  jeckyll2hide Jun 22 '12 at 7:43
    
Mmmm. getting closer: the reporting string is (for all files) <f..T....... According to the manpage, this is related to timestamps. –  jeckyll2hide Jun 22 '12 at 7:48
    
Do you call rsync with --times? –  Oliver Jun 22 '12 at 7:51
show 4 more comments

here was the way I did it. I don't think there is a flag to do this but there might be now

rsync -v [other options] | grep -v 'uptodate'
share|improve this answer
1  
My rsync (version 3.0.7) does not add uptodate to the reporting, so not possible to filter that out. –  jeckyll2hide Jun 22 '12 at 7:37
add comment

one thing that comes to my mind is using more verbose log format and awk'ing out what you want to get.

eg:

rsync -a --out-format="%b  %i %f" /etc/ /tmp/qq/ |awk '{if ($1>0) {print $3}}'

this is not very robust, it'll not handle well file-names with spaces.

share|improve this answer
add comment

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.