Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare two folders on two different servers

Status
Not open for further replies.

kzn

MIS
Jan 28, 2005
209
GB
Hi

I am using Rsync to replicate folders from one server to another. I want to run a script that will quickly compare the two. All I need it to do is list the files that are not the same, I dont need a deep scan all I want it do is compare the size of the two files ... nothing else.

locally on one server I have compared two folders using the following command

diff -q folder1 folder2

How can I make it compare folder1 on server 172.16.0.55 at location A to folder2 on server 10.0.0.2 at location B?

Any help appreciated.

Many thanks,
 
Something quick and dirty like this perhaps:

Code:
ssh 172.16.0.55 'cd /folder1 ; find . -type f | xargs ls -ld | awk "{print \$5,\$9}" | sort -k 2,2' > first
ssh 10.0.0.2 'cd /folder2 ; find . -type f | xargs ls -ld | awk "{print \$5,\$9}" | sort -k 2,2' > second
diff first second

Note that I'm assuming no spaces in filenames; you'd need to make it a little smarter to handle that.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top