Compare two directories in different servers

I have a requirement.

I need to write a shell script which will compare two directories residing in two different servers (SERVER A and SERVER B) and list out the discrepancies if found any.

Script will be running from SERVER A.

Please help.

You can do this a number of ways.

Take a look at rsync including the --list-only option.

Does rsync do a file diff or it copies files to the other directory to sync the folders?

I just need to find the list of files that differs in the two dirs.