1

I have a directory of directories. Each directory contains ~100 images. I want to create a zip for each directory.

How can I do that?

1 Answer 1

1

Goto the directory in a Terminal window and run the following:

find . -type d -depth 1 -exec zip -r {}.zip {} \;
  • find .
    • searches the path
  • -type d
    • only allows directories
  • -depth 1
    • up to a depth of one
  • -exec <cmd> {} \;
    • execute cmd for each result {} you find

And finally zip -r <dest> <src> which zips the directories recursively.

2
  • Didn't work. It produced the zips but they're all less than 1kb.
    – Harry
    Aug 21, 2013 at 4:53
  • Updated the answer to add the recursive option. Aug 21, 2013 at 5:55

You must log in to answer this question.

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