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.

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

share|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
add comment

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
share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

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