I know I can remove __MACOSX in a zip file by:

sudo zip -d bg1.zip "__MACOSX*"

but I want to remove it in all zip files, I tried

sudo zip -d *.zip "__MACOSX*"

but it says

zip warning: name not matched: __MACOSX*

zip error: Nothing to do! (bg1.zip)

and seems stop from processing next file. How can I remove all __MACOSX in a list of zip files?

  • 1
    Why are you using sudo? Is that necessary? Are all the .zip files in the same directory? – user3439894 Jun 15 '16 at 11:20

If all .zip files are in the same directory, cd to that directory and use:

for f in *.zip; do zip -d "$f" "__MACOSX*"; done

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .