Olivier
Olivier

Reputation: 3471

rsync --exclude-from option won't ignore directories with spaces

I'm having a hard time making an --exclude-from= file correctly exclude directories with spaces with rsync (v3.0.9 from macports).

Trying to ignore a folder named Adele - 21 [2011] flac/

Tried :

- Adele - 21 [2011] flac/
- "Adele - 21 [2011] flac/"
- "Adele\ -\ 21\ [2011]\ flac/"
- 'Adele - 21 [2011] flac/'
- 'Adele\ -\ 21\ [2011]\ flac/'

Tried -s switch.

Still not working...


EDIT : what the hell! This seems to be working :

- Adele - 21 \[2011\] flac/

Upvotes: 1

Views: 1775

Answers (1)

Aaron Digulla
Aaron Digulla

Reputation: 328754

Your problem is that the parameter for --exclude is a regular expression.

This means Adele - 21 [2011] flac matches Adele - 21 followed by one of [012] followed by flac

To fix this, you need to escape the special characters [ and ]

Upvotes: 3

Related Questions