-1

I am trying to find the differences between a directory in my local computer and a remote server. After a lot of trial and error i have found the following command from here:

diff -q <('sudo ls -1aR /home/spyros/Daily-Backup') <(ssh root@1.1.1.1 'sudo ls -1aR Daily-Backup/')

which seems to work for the second part of the ssh but it produces the following error when run:

sudo ls -1aR /home/spyros/Daily-Backup: No such file or directory

for the file in my computer. Any ideas?

J.S
  • 1

2 Answers2

1
diff -q <('sudo ls -1aR /home/spyros/Daily-Backup') <(ssh root@1.1.1.1 'sudo ls -1aR Daily-Backup/')

The quote ' makes the sudo command act like one string, instead of cmd with args. Remove the quotes. This should work:

diff -q <(sudo ls -1aR /home/spyros/Daily-Backup) <(ssh root@1.1.1.1 'sudo ls -1aR Daily-Backup/')
Scott Lundberg
  • 2,364
  • 2
  • 14
  • 22
AlexT
  • 11
  • 3
0

Use rsync with --dry-run. For example this will tell you what has to change if you were to write your local copy to the server. Note that rsync syntax is special, and the trailing slash is relevant.

rsync -avP --dry-run --stats /home/spyros/Daily-Backup/ root@1.1.1.1:Daily-Backup/
Peter
  • 2,756
  • 1
  • 20
  • 26