List the differences between two folders on different hosts


January 2014.

Situation


You want to know the differences between two folders on different unix servers.

Solution


This will list the files that are different, based on their contents.

rsync -rvnc /folder/on/the/local/host someremotehost:/folder/on/the/remote/host | grep -E '^deleting|[^/]$' | sed 1d | sed '$d' | sed '$d'

You can get a diff between two files using the following idea:

ssh someremotehost "cat /folder/on/the/remote/host/stuff/file1.txt" | diff /folder/on/the/local/host/stuff/file1.txt -