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.

I want to copy my c directory with all subdirectories excluding ./git subdirectory. I do it using rsync :

echo "copy c and sh files "
rsync -a --include='*.c' --include='*.sh' --include='*/' --exclude='*' ~/c/ ~/Dropbox/Public/c
# remove .git directory = do not send it to dropbox. Thx to Tomasz Sowa
rm -rf ~/Dropbox/Public/c/.git

Can I do it better?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Just add an explicit exclude for .git:

rsync -a --exclude='.git/' --include='*.c' --include='*.sh' --include='*/' --exclude='*' ~/c/ ~/Dropbox/Public/c

Another option is to create ~/.cvsignore containing the following line along with any other directories you'd like to exclude:

.git/

share|improve this answer
    
Works good. Thx. I was trying some options without success. –  Adam Nov 10 '13 at 15:57
    
@Adam : If you are satisfied with this answer, please tick the checkmark on the left. –  TAFKA 'goldilocks' Nov 10 '13 at 16:06
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.