You are not logged in.

#1 2010-07-09 18:09:02

jalu
Member
Registered: 2009-04-05
Posts: 140

rsync: Report only adds or deletes

This is kind of a basic question, but I can't seem to figure it out. Is there a way to get rsync to only print to stdout when it adds or deletes a file?

For example, with -v rsync prints something like this (the output is not verbatim, but an example of the output format I see):

$ rsync --delete -ahv [src] [dest]
distros
distros/arch
distros/mint
distros/mint/new-file.png
distros/ubuntu
deleting distros/ubuntu/old-file.png

I would like to get rsync to instead print something roughly like this:

$ rsync --delete -ahv [src] [dest]
adding distros/mint/new-file.png
deleting distros/ubuntu/old-file.png

Is it possible to get rsync to report information that way? I ask because I use rsync to transfer files to Rockbox, and with hundreds of music folders, it's hard to see what's added and deleted with each run.

Thanks as always.

Last edited by jalu (2010-07-09 18:12:52)

Offline

#2 2010-07-09 19:44:09

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,095
Website

Re: rsync: Report only adds or deletes

grep the output.

rsync ... | grep -E "^adding|^deleting"

Offline

#3 2010-07-10 07:19:09

jalu
Member
Registered: 2009-04-05
Posts: 140

Re: rsync: Report only adds or deletes

Hey falconindy. Thanks for the reply.

The only problem is that rsync does not print the word "adding" when adding a file. Instead it only prints the name of the filename that was added, which is of course difficult to grep for.

For example:

$ rsync --delete -ahv [src] [dest]
distros
distros/arch
distros/mint
distros/mint/new-file.png   // Adds a file.
distros/ubuntu
deleting distros/ubuntu/old-file.png   // Deletes a file.

I've looked into different formatting options such as rsync -i and rsync with multiple levels of verbosity, but unfortunately nothing prints simple adds/deletes or makes it easy to parse for adds/deletes.

But thanks for the info. At the very least, thanks for introducing me to some new grep syntax! :-)

Offline

#4 2012-09-02 12:02:43

technic
Member
Registered: 2012-09-02
Posts: 4

Re: rsync: Report only adds or deletes

As for now --itemize-changes option could be usefull.

Offline

Board footer

Powered by FluxBB