Reputation: 5098
I would like to zip all files/dirs while excluding a few listed within the variable $excludes. However the following piece of code is not excluding those files.
excludes='"dir1/*" "dir2/*" "dir3/*"'
zip -r zipfile * -x $excludes
Upvotes: 2
Views: 86
Reputation: 786091
This should work:
zip -r zipfile * -x dir1/* dir2/* dir3/*
Or even this should work:
excludes='dir1/* dir2/* dir3/*'
zip -r zipfile * -x "$excludes"
Upvotes: 1
Reputation: 805
Have you tried escaping the asterisk with a backslash:
excludes='"dir1/\*"'
Upvotes: 1