How do I make a .zip file that contains every file AND every folder in the directory?

link|improve this question
Does it need to be a .zip or are you just after a compressed file? – Tim Joseph Nov 23 '10 at 3:41
1  
This is definitely a question that either belongs on superuser.com or one for which the asker should have checked a man page first. – idealmachine Nov 23 '10 at 3:48
feedback

migrated from stackoverflow.com Nov 23 '10 at 23:43

This question came from our site for professional and enthusiast programmers.

4 Answers

zip -r foo.zip dir_path
link|improve this answer
feedback

Use the -r option. From zip(1):

-r

Travel the directory structure recursively; for example:

zip -r foo foo

The name of the zip file comes first. "Recursively" means that the zip file will include subfolders of the given folder, the subfolders of those folders, and so on.

link|improve this answer
feedback

Try:

zip -r filename.zip /path/to/folder

Note - this will go recursively, i.e. it will zip all folders and all subfolders of the given folder.

link|improve this answer
feedback

If you are bound to a zip, I'd use:

zip -r zipfilename directoryPath

The -r is the key, but you can find all the options here:

http://www.perpetualpc.net/srtd_zip.html

link|improve this answer
feedback

Your Answer

 
or
required, but never shown