Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to keep two directories "in sync" such that the local version may contain only a subset of the remote version. So, syncing them up should result in any changes to the local subset being pushed to the remote directory, and any changes to the remote directory, that are made to the relevant subset, being pulled in to the local directory. However, I don't want any new files or directories being pulled from the remote directory without them being explicitly copied.

(The reason I want to do this is because I have a very large music collection on a remote server, but I cannot fit the entire collection on my laptop at once, for lack of disk space. However, I'd like to keep whatever portion of the collection, that I do have here locally, synchronized with the relevant portion on the server, particularly for cases where I've updated ID3 tags, Vorbis comments, etc.)

rsync's --ignore-non-existing flag seemed like a reasonable way to do this, from its documentation in the man page, but it did not yield the expected results. It skips over the first level of sub-directories, even though both root directories contain the same children.

E.g., if remote directory contains dir1 and dir2, and local directory /other/dir/ contains dir1 and dir2, I get the following results...

$ rsync --dry-run --ignore-non-existing /other/dir/
skipping directory .

Or trying it with a wildcard...

$ rsync --dry-run --ignore-non-existing* /other/dir/
skipping directory dir1
skipping directory dir2

Does anyone know how to properly use this flag? Or am I misunderstanding its purpose? Or, if you have any other suggestions for keeping a subset of a directory in sync, please let me know.

Thanks. :)

share|improve this question
up vote 0 down vote accepted

Try doing it recursively:
rsync --recursive --dry-run --ignore-non-existing /other/dir/

share|improve this answer
Thanks, that seemed to do the trick. (Though, I'm still not sure this rsync command solves my larger problem, as it seems rsync only syncs one way, in contrast to something like Unison.) – Chris W. Aug 12 '10 at 21:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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