I'm trying to zip a directory a linux using the following command:
zip -r file.zip .
This works, but it isn't include the empty directories that I want to be included in the zip file. How can I get them to be included?
What version of zip are you using? I've got:
And if I create some directories:
And then create a zip file:
The resulting archive appears to have the empty directories:
The answer you're most likely looking for is:
You get a warning when zipping an empty folder but again the solution is size-agnostic for its function. It works for empty and non-empty directories.
This solution works in the relative sense unlike solutions that use $PWD such as
which will compress the whole folder structure.