Note it looks like there are pre-existing questions that are similar, but the solutions to those answers have not worked for me. See: How to zip files without the top level folder but keep the sub folders
I have this folder structure:
index.js
node_modules/some_module
If I zip these with just -r
:
zip -r bundle.zip *
Then I will get something like:
bundle/
index.js
some_file_from_module.js
another_file_from_module.js
...
Everything will be inside of a /bundle
folder.
I can remove the bundle folder with -j
zip -jr bundle.zip *
But then all of my subfolders are removed:
index.js
some_file_from_module.js
another_file_From_module.js
...
Is there a way I can retain the folder structure I want without having the top level bundle
folder after unzipping the zip?
CodePudding user response:
The way to do this is:
cd bundle
zip -r ../bundle.zip *
cd ..