Do not show directories in rsync output

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|[^/]$'

I'd be tempted to filter using by piping through grep -E -v '/$' which uses an end of line anchor to remove lines which finish with a slash (a directory).

Here's the demo terminal session where I checked it...

cefn@cefn-natty-dell:~$ mkdir rsynctest
cefn@cefn-natty-dell:~$ cd rsynctest/
cefn@cefn-natty-dell:~/rsynctest$ mkdir 1
cefn@cefn-natty-dell:~/rsynctest$ mkdir 2
cefn@cefn-natty-dell:~/rsynctest$ mkdir -p 1/first 1/second
cefn@cefn-natty-dell:~/rsynctest$ touch 1/first/file1
cefn@cefn-natty-dell:~/rsynctest$ touch 1/first/file2
cefn@cefn-natty-dell:~/rsynctest$ touch 1/second/file3
cefn@cefn-natty-dell:~/rsynctest$ touch 1/second/file4

cefn@cefn-natty-dell:~/rsynctest$ rsync -r -v 1/ 2
sending incremental file list
first/
first/file1
first/file2
second/
second/file3
second/file4

sent 294 bytes  received 96 bytes  780.00 bytes/sec
total size is 0  speedup is 0.00


cefn@cefn-natty-dell:~/rsynctest$ rsync -r -v 1/ 2 | grep -E -v '/$'
sending incremental file list
first/file1
first/file2
second/file3
second/file4

sent 294 bytes  received 96 bytes  780.00 bytes/sec
total size is 0  speedup is 0.00