how to compare files/directories of 2 separate solaris boxes?

1

1

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?

chz

Posted 2011-02-20T13:20:09.527

Reputation: 339

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.

Randolf Richardson

Posted 2011-02-20T13:20:09.527

Reputation: 14 002

+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 – 2011-02-20T19:13:05.737

1

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.

Arcege

Posted 2011-02-20T13:20:09.527

Reputation: 1 883