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

I'm currently using rsync on a script that deploys a PHP application from a staging to a production server. Here is how:

rsync -rzai --progress --stats --ignore-times --checksum /tmp/app_export/ root@app.com:/var/www/html/app/

This is currently outputting a list of every file that's being compared (every file in the project), but I'd like it to output only the modified ones, so I can run it with a --dry-run option to check that every deploy is updating only the desired files.

NOTE: The best I could do so far is grep fcst the results, but I'm looking for an rsync option that I'm sure it's there but I can't find it in the man pages.

Thanks in advance!

share|improve this question

2 Answers 2

up vote 3 down vote accepted

If there's an rsync option to do exactly what you're asking, I didn't find it in the manpage either. :-)

That said, I don't see the problem with grepping the output of rsync -i to parse out exactly what you need. That feels nice and Unixy to me.

One nit-picky quibble with your rsync command: the -r is redundant, as it is implied by -a.

share|improve this answer
1  
Thanks man. I wonder why (with the variety of options this program has) there isn't an option for that. Seems pretty basic for me. –  Mauro Sep 11 '12 at 22:15

Beginning with rsync v3.1.0, released in 2013, there is the --info flag which allows fine-grained control over the output.

 --info=FLAGS
          This option lets you have fine-grained control over the information output you want to see.  An individual flag name may be followed
          by a level number, with 0 meaning to silence that output, 1 being the default output level, and higher numbers increasing the output
          of that flag (for those that support higher levels).  Use --info=help to see all the available flag names,  what  they  output,  and
          what flag names are added for each increase in the verbose level.  Some examples:

              rsync -a --info=progress2 src/ dest/
              rsync -avv --info=stats2,misc1,flist0 src/ dest/

          Note  that  --info=name’s  output  is  affected  by the --out-format and --itemize-changes (-i) options.  See those options for more
          information on what is output and when.

          This option was added to 3.1.0, so an older rsync on the server side might reject your attempts at fine-grained control (if  one  or
          more  flags  needed  to  be  send to the server and the server was too old to understand them).  See also the "max verbosity" caveat
          above when dealing with a daemon.

The available --info flags are:

Use OPT or OPT1 for level 1 output, OPT2 for level 2, etc.; OPT0 silences.

BACKUP     Mention files backed up
COPY       Mention files copied locally on the receiving side
DEL        Mention deletions on the receiving side
FLIST      Mention file-list receiving/sending (levels 1-2)
MISC       Mention miscellaneous information (levels 1-2)
MOUNT      Mention mounts that were found or skipped
NAME       Mention 1) updated file/dir names, 2) unchanged names
PROGRESS   Mention 1) per-file progress or 2) total transfer progress
REMOVE     Mention files removed on the sending side
SKIP       Mention files that are skipped due to options used
STATS      Mention statistics at end of run (levels 1-3)
SYMSAFE    Mention symlinks that are unsafe

ALL        Set all --info options (e.g. all4)
NONE       Silence all --info options (same as all0)
HELP       Output this help message

Options added for each increase in verbose level:
1) COPY,DEL,FLIST,MISC,NAME,STATS,SYMSAFE
2) BACKUP,MISC2,MOUNT,NAME2,REMOVE,SKIP
share|improve this answer

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.