Skip to content

Instantly share code, notes, and snippets.

@bogdanRada
Forked from aserrallerios/compare-over-ssh.md
Created April 17, 2020 08:23
Show Gist options
  • Save bogdanRada/9737925def619b42dfdb919860ea0760 to your computer and use it in GitHub Desktop.
Save bogdanRada/9737925def619b42dfdb919860ea0760 to your computer and use it in GitHub Desktop.
FROM: https://stackoverflow.com/questions/20969124/how-to-diff-directories-over-ssh
Try using "rsync" with the "-n" option, which just does a "dry run" and tells you what it would do.
answered Jan 7 '14 at 10:39
Mark Setchell
-c will tell rsync to look at checksums, not just date & length – Mike Aug 5 '14 at 22:07
--delete is needful. Without it, you won't see any files that are present on the 2nd machine but not on the 1st. Make sure you have the dry run -n option. – JellicleCat Mar 22 '15 at 15:12
of course you also need -r or -a for your recursion, and don't forget to add the backslashes after directory names (but then no star), otherwise somehow --delete doesn't return any deletions. so your command would be rsync -e 'ssh -p 22' -azvn --delete [email protected]:/home/admin/ /home/admin/. – TNT Mar 16 '16 at 6:13
Another handy option: --itemize-changes (-i) will tell you for each file what has changed. – Florian Brucker Feb 26 '18 at 9:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment