I am looking for a script to find out the differences between a local and remote file systems (over SSH). Ideally the script should do the following:
-browse the local file system for folders
-find out whether folder is present on remote file system (report if missing and stop inspecting further the folder)
-for folders present of both file systems, do a diff of files they contain (report whether remote file missing or different).

The only thing I could find on serverfault was example as to how doing diffs on individual files and folders:
How to compare differences between directories (linux)
How do diff over ssh?

The script can be written in any language, it doesn't matter at this point (although bash/perl are preferred).

  • 1
    whats wrong with rsync?
    – Niko S P
    Commented Feb 28, 2012 at 12:06
  • A script of this complexity is most likely beyond the scope of ServerFault. What are you trying to achieve ?
    – user9517
    Commented Feb 28, 2012 at 12:11
  • 1
    Is it possible to transfer both sets of files to a Windows PC, and use something like WinMerge to do this? It sounds like WinMerge will do almost exactly what you want, just not the SSH or remote file system part.
    – user11604
    Commented Feb 28, 2012 at 12:23
  • I agree, thinking about it again I might want to download files from both servers locally and use a program like Meld (meldmerge.org/features.html) or an equivalent.
    – Max
    Commented Feb 28, 2012 at 13:02

2 Answers 2


rsync with the --dry-run and -v parameters will report the files and directories, whether they are present on the remote side and also detect differences in files (by checksumming). There is plenty of documentation on the net about how to get it running over SSH.

If you prefer a different approach, you could mount a remote directory locally using FUSE/SSHfs and use any set of tools which would work locally.


One terrible simple solution that does nearly everything you want but doesn't stop descending into folders nonexistent on the target would be to use rsync with the checksum validation doing a --dry-run:

rsync -av -c --dry-run source/ user@target:/target/  

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .