Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

Here is my current rsync shell script


##rsync -avzL --delete --include '*/' --include-from=list.txt --exclude '*' $DESTDIR $SOURCEDIR

rsync -avzL --delete --exclude=".DS_Store" --exclude-from=list.txt $SOURCEDIR $DESTDIR



What I am trying to accomplish here is a rsync download of the list directories then an upload of everything except the list directories. The second script works and avoids the list files but the first doesn't do what I want completely. I've gotten it to work if I append ** to the end of the directories but I'm not sure this works for the second script. I am looking for the optimal way of doing this.

share|improve this question

If you have a recent enough version of rsync (at least 2.6.7), then you can use reggi.com/assets/dailybooth/img/original/*** in list.txt, and so on. Then both your commands will work. I don't think there's a less clumsy way. You may want to add --prune-empty-dirs to the first command.

I question your general work flow. It's rather weird to copy specific directories in one direction and the rest in the other direction. I recommend arranging to have identical contents on both sides, and to perform bidirectional synchronization whenever you make a change on either side. The tool of choice for bidirectional synchronization is Unison.

share|improve this answer
I realize your concern, would Unison need to be installed on my ssh web server or just locally? If you don't mind me asking, what is the significance of the each asterisk after the directory? I have never seen this syntax, is it a wildcard, why three? – ThomasReggi Oct 11 '11 at 8:31

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.