Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.