Reputation:
I see that when I use rsync with the -v option it prints the changed files list and some useful infos at the end, like the total transfer size.
Is it somewhat possible to cut out the first (long) part and just print the stats? I am using it in a script, and the log shouldn't be so long. Only the stats are useful.
Thank you.
Upvotes: 6
Views: 2587
Reputation: 2175
Best solution for now i think :
rsync --info=progress0,name0,flist0,stats2 ...
Upvotes: 5
Reputation: 542
As I was looking for an answer and came across this question:
rsync also supports the --stats
option.
Upvotes: 5
Reputation: 4954
This solution is more a "hack" than the right way to do it because the output is generated but only filtered afterwards. You can use the option --out-format
.
rsync ... --out-format="" ... | grep -v -E "^sending|^created" | tr -s "\n"
The grep
filter should probably be updated with unwanted lines you see in the output. The tr
is here to filter the long sequence of carriage returns.
grep -E
for extended regexesgrep -v
to invert the match. "Selected lines are those not matching any of the specified patterns."tr -s
to squeeze the repeated carriage returns into a single oneUpvotes: 1