Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Here is my current rsync shell script

upload.sh

SOURCEDIR=/Users/thomas/sites/dreamhost/
DESTDIR=******@reggi.com:/home/thomasreggi/sites/
##rsync -avzL --delete --include '*/' --include-from=list.txt --exclude '*' $DESTDIR $SOURCEDIR

SOURCEDIR=/Users/thomas/sites/dreamhost/
DESTDIR=******@reggi.com:/home/thomasreggi/sites/
rsync -avzL --delete --exclude=".DS_Store" --exclude-from=list.txt $SOURCEDIR $DESTDIR

list.txt

reggi.com/assets/dailybooth/img/original/
reggi.com/assets/dailybooth/img/spritesheets/
reggi.com/assets/dailybooth/sprite.css
reggi.com/assets/thumb/cache/
reggi.com/wordpress/wp-content/plugins/
reggi.com/wordpress/wp-content/uploads/

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
add comment

1 Answer 1

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
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
add comment

Your Answer

 
discard

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.