compare contents of two directories on remote server using unix

You can use rsync with the -n flag to find out if the files are in sync, without actually doing a sync.

For example, from server1:

rsync -n -avrc /abc/home/sample1/* server2:/abc/home/sample2/

This will print the names of all files (recursive, with the -r flag) that differ between server1:/abc/home/sample1/ and server2:/abc/home/sample2/

rsync used parameters explanation

-n, --dry-run – perform a trial run with no changes made

-a, --archive – archive mode; equals -rlptgoD (no -H,-A,-X)

-v, --verbose – increase verbosity

-r, --recursive – recurse into directories

-c, --checksumskip based on checksum, not mod-time & size

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)