How do I make a .zip file that contains every file AND every folder in the directory?
24 Answers
zip -r foo.zip dir_path 5 Try:
zip -r filename.zip /path/to/folderNote - this will go recursively, i.e. it will zip all folders and all subfolders of the given folder.
Use the -r option. From zip(1):
-rTravel 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.
2If you are bound to a zip, I'd use:
zip -r zipfilename directoryPathThe -r is the key, but you can find all the options here.