I am trying to recursively compare a directory in the local host to a directory in a remote linux machine. However, when i execute the next command:
diff -r
You can mount the remote directory via sshfs
, then you can use diff -r
to compare the two directories as you want to do it.
Alternatively you could run similar find
commands on both machines to print the file trees (e. g. file names, sizes, and dates) and then compare the outputs of both using diff
. This would not compare file contents, of course:
diff <(ssh host find /home/admin -printf '"%8s %P\n"') \
<(find /home/admin -printf '%8s %P\n')
Notice the double quoting of the printf-format string in the ssh
call. One layer is removed by the ssh
relay.