Comparing files names in directory over two servers

Hi folks
I need to write a shell script to check whether source and the destination has the same files. The source and destination are over two servers and connecting through ssh. It should even compare the date i.e, the complete file name, date stamp and size should match. Should list out all the unmatched files in a log file.

Thank you so much :slight_smile:

Warm Regards
Olivia

rsync is the tool for this sort of thing, the --dry-run option should report what would happen if you went ahead, it runs over ssh and is quite configurable.

This might be a good starting point:

rsync -avx --del --dry-run /path/to/local/tree  remote:/path/to/remove/tree > logfile
1 Like

Thank you so much.. can you brief me what does --del mean??

--del removes files/directories in the destination path that don't exist in the source. This is done during transfer of changed/new files (not before or after).