How can I easily confirm in Linux that two separate directories have the exact same contents?

Posted by Mike B on Server Fault See other posts from Server Fault or by Mike B
Published on 2012-05-18T20:43:19Z Indexed on 2012/05/31 22:43 UTC
Read the original article Hit count: 177

Filed under:
|
|
|

CentOS 5.x

Mq question seemed similar to this one but I wasn't sure...

I have two servers (completely isolated from each other), each with a directory and sub-directories that should have the same exact contents.

For example the directory layout could be something like:

SERVER A -

/opt/foo/foob/1092380298309128301283/123.txt
/opt/foo/foob/5094380298309128301283/456.txt
/opt/foo/foob/5092380298309128301283/789.txt
/opt/foo/foob/1592380298309128301283/abc.txt

SERVER B -

/opt/foo/foob/1092380298309128301283/123.txt
/opt/foo/foob/5094380298309128301283/456.txt
/opt/foo/foob/5092380298309128301283/789.txt
/opt/foo/foob/1592380298309128301283/abc.txt

Ideally I'd like a way to do a recursive check and have something confirm that everything matches.

I also want to avoid using any third-party tools.

Any ideas?

© Server Fault or respective owner

Related posts about linux

Related posts about centos