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

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

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

    
Does it need to be a .zip or are you just after a compressed file? –  Tim Joseph Nov 23 '10 at 3:41
    
I use 'tar': tar -zcvf archive.tar.gz directory/ unix.stackexchange.com/questions/93139/… –  njuhgn Oct 20 at 5:21

4 Answers 4

zip -r foo.zip dir_path
share|improve this answer

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

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

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.

share|improve this answer

Your Answer

 
discard

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