Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 1 down vote accepted

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.

share|improve this answer
    
Didn't work. It produced the zips but they're all less than 1kb. – Harry Aug 21 '13 at 4:53
    
Updated the answer to add the recursive option. – Daniël W. Crompton Aug 21 '13 at 5:55

You must log in to answer this question.

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