When rsync prints out the details of what it did for each file (using one of the verbose flags) it seems to include both files that were updated and files that were not updated. For example a snippet of my output using the -v
flag looks like this:
rforms.php is uptodate
robots.txt is uptodate
sorry.html
thankyou.html is uptodate
I'm only interested about the files that were updated. In the above case that's sorry.html
. It also prints out directory names as it enters them even if there is no file in that directory that is updated. Is there a way to filter out uptodate files and directories with no updated files from this output?
By default, rsync will only copy new or changed files from a source to a destination. The –update or -u option is used by rsync to skip files that are still new in the destination directory. Also, –dry-run or -n enables us to execute a test operation without making any changes.
Also, rsync provides the ability to synchronize a directory structure (or even a single file) with another destination, local or remote. To accomplish this efficiently, by default, it will check the modification times of files.
Method 1: Using –progress option to see the rsync progress:Use the “–progress” in the rsync command and “-av” to get a summary at the end of file transfer, consisting of transfer rate, sent/receive bytes, speed of transfer, and total file size.
Files that do not exist on the remote-host are copied. Files that have been updated will be synced, rsync will copy only the changed parts of files to the remote host. File that is exactly the same are not copied to the remote host at all.
You can pipe it through grep:
rsync -vv (your other rsync options here) | grep -v 'uptodate'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With