user2726694
user2726694

Reputation:

rsync verbose with final stats but no file list

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

Answers (3)

Raphael PICCOLO
Raphael PICCOLO

Reputation: 2175

Best solution for now i think :

rsync --info=progress0,name0,flist0,stats2 ...

  • progress0 hides progress
  • progress2 display progress
  • name0 hides file names
  • stats2 displays stats at the end of transfer

Upvotes: 5

Thomas
Thomas

Reputation: 542

As I was looking for an answer and came across this question:
rsync also supports the --stats option.

Upvotes: 5

Ludovic Kuty
Ludovic Kuty

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 regexes
  • grep -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 one

Upvotes: 1

Related Questions