Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to exclude .DS_store in rsync

Tags:

macos

rsync

My code

rsync -exclude='.gitconfig' -exclude='*~' -exclude='.DS_Store' /Users/Masi/bin/ /Users/Masi/gitHub/dvorak/

I run it. It copies the .DS_Store to the destination folder although it should not.

This suggests me that the first exclusion do not work. It seems to be hard-coded in Git's default ignore -file to ignore .gitconfig.

How can you avoid the coping of .DS_Store?

like image 630
Léo Léopold Hertz 준영 Avatar asked Jun 27 '09 23:06

Léo Léopold Hertz 준영


2 Answers

It looks like you're missing a dash on your "--exclude" flags. Without it, I suspect rsync is thinking you're passing it a -e flag with the value "xclude=.DS_Store"; not at all what you want.

like image 103
Gordon Davisson Avatar answered Nov 01 '22 11:11

Gordon Davisson


Try the following. Place your list of items to exclude in a file

~/.rsync/exclude

One per line (wildcards acceptable).

Then use the appropriate option to read the exclusions from that file:

--exclude-from=~/.rsync/exclude

You may also wish to ask this on ServerFault, the sister site.

like image 43
dreadwail Avatar answered Nov 01 '22 12:11

dreadwail