I am using rsync to backup the files.

I want that after backup i should get the following info

1)No of FIles copied 2)No of file deleted in destination 3)How much data copies

and nothing else

If i use quiet mode then i get no info but if i don't then i get all the files info as well which is very long

link|improve this question
feedback

1 Answer

up vote 0 down vote accepted

Some of that information will be output by the --stats option.

You can use the command below to count the deleted files. It also suppresses the output of the copied filenames. You may need to modify it to match the output of your particular rsync option selection. I've included a simple rsync command as an example. Note that the --stats and --verbose options are required for this to work.

rsync --archive --delete --stats --verbose from to | \
awk 'BEGIN {count = flag = 0} \
    /^deleting/ {count++; next} \
    /^Number of files: [0-9]*$/ {flag=1; print "Files deleted: " count} \
    {if (flag == 1) {print}}'
link|improve this answer
but if i use quite mde then it don't display anything but if i don't then i get all list of files copies that too long – John May 3 '10 at 2:58
@Mirage: See my edited answer. – Dennis Williamson May 3 '10 at 3:02
thanks for that i will try that – John May 3 '10 at 4:25
Can i put that awk programming lines inside a file for better viewing inside crontab. DO i have to write "from to" in the command as well – John May 3 '10 at 4:41
@Mirage: No, "from" and "to" just represent the source and destination in my example. You would use the ones you normally would (plus any other options and arguments you need (except for --quiet). Yes, you can create a script file out of the awk command. – Dennis Williamson May 3 '10 at 5:33
show 1 more comment
feedback

Your Answer

 
or
required, but never shown