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

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

share|improve this question

migrated from 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/… – njuhgn Oct 20 '14 at 5:21
zip -r dir_path
share|improve this answer
The -r means recursive and tells it to go through all of the sub folders. You don't really need the .zip on the filename ( as it will create this anyway. – user2924019 Jul 21 at 7:50


zip -r /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):


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

You must log in to answer this question.