Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
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 ? –  Iain 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 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 (meldmerge.org/features.html) or an equivalent. –  user64204 Feb 28 '12 at 13:02
add comment

2 Answers

up vote 5 down vote accepted

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.

share|improve this answer
add comment

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/  
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.