Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have 2 solaris boxes and I need to check certain directories (on local filesystem and mounted nfs) to make sure that they match up on both boxes and to delete or move the other mismatches to elsewhere on the local filesystem.

I investigated for unix commands like rsync, and tree but it appears that these commands are not supported on my Solaris boxes.

What is the best approach to this problem with the least pain to solve it ? to use rsync, tree and then diff the outputs or find ?

I have trouble limiting the find command to certain directories as there are mounted folders that contain too many xml files that I don't care to much in that directory.

What's the find command to search multiple directory paths on a single find command?

share|improve this question

migrated from stackoverflow.com Feb 20 '11 at 13:59

This question came from our site for professional and enthusiast programmers.

2 Answers 2

I think "rsync" could be very good for this. You'll want to pay particular attention to the "--dry-run" and "--compare-dest" command-line switches.

share|improve this answer
    
+1 for rsync by itself. I would suggest using the '-c' checksum option to compare the contents of the files instead of --compare-dest. Should make the whole thing a bit faster since file contents are not transferring over the net, only the md5 values. –  Arcege Feb 20 '11 at 19:13

You mentioned that rsync was not available on your Solaris box, so here is another possible solution.

(cd ${localdir}; find . -type f -exec md5sum {} \;) > /tmp/md5s.lcl.lst & lclpid=$!
ssh -n ${remotesrv} "cd ${remotedir} && find . -type f -exec md5sum {} \;)" > /tmp/md5s.rem.lst & rempid=$!
wait $lclpid; wait $rempid
comm -12 /tmp/md5s.lcl.lst /tmp/md5s.rem.lst

Of course this assumes that you should have md5sum on your boxes. If I remember correctly, it was there in earlier releases.

share|improve this answer

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.