3

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).

Max
  • 3,373
  • 15
  • 51
  • 71
  • 1
    whats wrong with rsync? – Niko S P Feb 28 '12 at 12:06
  • A script of this complexity is most likely beyond the scope of ServerFault. What are you trying to achieve ? – user9517 Feb 28 '12 at 12:11
  • 1
    Is it possible to transfer both sets of files to a Windows PC, and use something like [WinMerge](http://winmerge.org/) to do this? It sounds like WinMerge will do almost exactly what you want, just not the SSH or remote file system part. – Bryan Feb 28 '12 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` (http://meldmerge.org/features.html) or an equivalent. – Max Feb 28 '12 at 13:02

2 Answers2

5

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.

the-wabbit
  • 40,319
  • 13
  • 105
  • 169
3

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/  
Sven
  • 97,248
  • 13
  • 177
  • 225