I have a folder.

I have one copy of this folder locally and one on a server. I edited my local folder as I wanted and then rsync it to the server.

Is there any way of comparing those two copies, local and remote, and get back a list of files that are on the remote one and not the local one?


The following rsync command executed on the local machine lists the files that exist on the remote host but not the local host.

rsync -av --dry-run --delete somedir/ user@remote:~/somedir/

The --dry-run switch only lists the files, without actually doing something, the --delete switch in combination with -v (verbose) lists the files that would be deleted because they exist on the remote host, but not the local host, which is want you want.


Unison File Synchronizer does exactly that using the rsync algorithm for the heavy lifting. I use it daily.


If you already have ssh keys to do your rsync, you could issue a remote ssh command and list the files in the dir, then diff it with a copy from your local dir.

ssh user@remote.com ls -1 ~/foo > /tmp/remote.txt && ls -1 ~/foo > /tmp/local.txt && diff /tmp/remote.txt /tmp/local.txt

Extra credit, pipe the output of diff to colordiff for prettiness.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.