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.


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.

| improve this answer | |
  • 1
    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 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.