Do not show directories in rsync output

Koen Weyn picture Koen Weyn · Dec 20, 2011 · Viewed 8.4k times · Source

Does anybody know if there is an rsync option, so that directories that are being traversed do not show on stdout.

I'm syncing music libraries, and the massive amount of directories make it very hard to see which file changes are actually happening. I'v already tried -v and -i, but both also show directories.

Answer

Zurd picture Zurd · Oct 31, 2012

If you're using --delete in your rsync command, the problem with calling grep -E -v '/$' is that it will omit the information lines like:

deleting folder1/
deleting folder2/
deleting folder3/folder4/

If you're making a backup and the remote folder has been completely wiped out for X reason, it will also wipe out your local folder because you don't see the deleting lines.

To omit the already existing folder but keep the deleting lines at the same time, you can use this expression :

rsync -av --delete remote_folder local_folder | grep -E '^deleting|[^/]$'