Rsync – using dryrun to list changed files

Use rsync dryrun (-n) with -i (or –itemize-changes) to list changed files.

$ rsync -n -i -a ./dir1 ./destdir/
cd+++++++ dir1/
>f+++++++ dir1/file1.php
>f+++++++ dir1/file2.php

To get changed files as a list:

$ rsync -n -i -a ./dir1 ./destdir/  | egrep "^>f" | cut -d" " -f2

This can be useful to run php lint, etc. before pushing code to production.

Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit


Click here to write/view comments