Folder to zip
I've a folder /resources/html/article
(with css/js files)
Terminal Command
I'm executing following command to generate a zip file in node.js in order to closely mimic what a software utility does.
cd /resources/html/
&& $(which zip) -r article.zip article
A. My version
When I change the filename manually, let's say article.zip
to store.zip
, it extracts into folder called article
My version is still getting extracted to the original folder name.
B. Software Utility Version
When I change the filename manually, let's say article.zip
to utility.zip
, it extracts into folder called utility
Utility's version is using the current filename of the archive.
Hypothesis
I think because of the difference in extraction paths, server is not accepting my version when I upload, and I know file names do get change to temp names on the server when they are uploaded, that's why the server is unable to find the extracted folder.
Question:
In what way should I create the zip, any options should I specify that it closely mimic's the utility version.
zip -r article.zip article
will include article/
in every path name in the zip archive. So when you unzip, you unzip to the article/
directory, no matter what you name the .zip file. The name of the .zip file has no bearing whatsoever on what the result of the unzipping is named.
To get rid of the directory name, you would need to do the zip operation from inside the directory, so that the names passed to zip on the command line do not contain that directory name.