5

I want to remove __MACOSX directory in zip files that are made by Mac.

With zip foo.zip -qd "__MACOSX/*" works well.

Then I wrote like following. for file in "*.zip"; do zip $file -qd "__MACOSX/*"; done

But this script have effect only first zip file in the directory.

Next I try to use "find" and "xargs". But it didn't worked at all. find . -name "*.zip" -print0 | xargs -0 zip -qd "__MACOSX/*"

How can I write a script that removes all __MACOSX directory in multiple zip files.

1 Answer 1

5

You want to quote the $file in the command, but not the glob in the for:

for file in *.zip; do zip "$file" -qd "__MACOSX/*"; done

You must log in to answer this question.