Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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'd like to know how I can sync only existing files and directories in the target directory. For example, if I have in the source

a\, b\ , b.txt, a.txt

and in the target

a\, a.txt

Then I would like rsync to update a\ (including all files in it, on the source) and a.txt but ignore copying b\ and b.txt. Thanks for the inputs.

share|improve this question

Type in man rsync into the terminal to see the man page. It shows you all the options available and explains them. I think what you are looking for is

--existing              skip creating new files on receiver

so use it as option

rsync --existing
share|improve this answer
This does not help me. Because I do want files in the folder `a` in the above example to be created recursively. I just want to skip any files and folders being created on level 1. – ste_kwr Mar 30 '13 at 19:10
I think this is easy to miss when reading your question. Maybe you could make that detail stand out a little more. – André Stannek Mar 30 '13 at 21:48

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.