Operating System - HP-UX
1835002 Members
2159 Online
110073 Solutions
New Discussion

Comparing local and remote directory contents using dircmp

 
SOLVED
Go to solution
Shivkumar
Super Advisor

Comparing local and remote directory contents using dircmp

Hi,

I want to compare the contents of the directories between a local and remote server.
I would be login to a local box and wants to compare the contents of local dir /opt/somedir/ and remote directory
remotebox:/opt/somedir/

I have the ssh login between the 2 boxex.

Can someone suggest the command syntax to use ?

Thanks,
Shiv
2 REPLIES 2
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Comparing local and remote directory contents using dircmp

There is no command syntax to do this as stated. You would need to NFS export this filesystem (or part of it) on one host and then NFS mount it on the other host. You could then do the dircmp just as though they are local filetrees.

Plan B.
ssh mickey@remotebox find /opt/somedir -type f -exec ls -l {} \+ > /var/tmp/remotelist

find /opt/somedir -type f -exec ls -l {} \+ > /var/tmp/locallist

diff remotelist locallist

Plan C.
Use rdist with -n and/or -v to show what files would require syncing.

If it ain't broke, I can fix that.
Dennis Handly
Acclaimed Contributor

Re: Comparing local and remote directory contents using dircmp

In addition to Clay's Plan B, if you need to compare the file contents, you could use cksum(1) for each and then compare that.