10
1
I'm trying to create a ZIP file using the command line zip
tool that comes with the Mac OS X Terminal. I want to recursively compress the contents of the current folder but excluding .DS_Store
files. I'm trying with this:
zip -r myarchive.zip . -x .DS_Store
The -x .DS_Store
excludes the .DS_Store
file in the current folder, but not in the recursively added subfolders. How do I exclude all the .DS_Store
files from ALL subfolders as well?
Thanks for your answer. It works, but, why? :). Could you please explain? – OMA – 2015-09-11T17:43:33.343
The
*
expands to nothing or any part of a path as zip recursively compresses the files and their directories. So,./.DS_Store
then./*/.DS_Store
and so on are excluded from the archive. – fd0 – 2015-09-11T17:56:52.327Ah, interesting. So the wildcard works differently than in the Windows world, where "*.DS_Store" would just mean "any file that ends with .DS_Store" – OMA – 2015-09-11T22:03:30.517