question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create a zip with the files without any parent directory

See original GitHub issue

Hi, I’d like to have all my files directly into the zip without any folder.

So If I do that…

zip.addLocalFile('asset1.png');
zip.addLocalFile('asset2.png');
zip.addLocalFile('asset3.png');

zip.writeZip('files.zip');

… then extract files.zip, I’d like to have directly the 3 assets and not

files/asset1.png
files/asset2.png
files/asset3.png

Thanks a lot

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
corybillcommented, Jun 17, 2018

Realized this is a difference between mac and linux. On my Mac, it automatically unzips into a directory the same name as zip file. When I unzip on linux, it works as expected.

Hope this saves someone else some time.

0reactions
corybillcommented, Jun 17, 2018

Was there ever a resolution to this? I need to use ‘addLocalFolder’ and I need all of the files to be at the root of the zip.

The following code puts all the files in a root directory “my-zip”. Im using version 0.4.11.

const AdmZip = require("adm-zip");
const zip = new AdmZip();
zip.addLocalFolder("./sandbox/src/lib/", "./");

zip.writeZip("./spec/my-zip.zip");
Read more comments on GitHub >

github_iconTop Results From Across the Web

Zip an archive without including parent directory - Ask Ubuntu
Use the -j or --junk-paths option in your zip command. From the zip man page: -j --junk-paths Store just the name of a...
Read more >
Zip a file without including the parent directory
My goal is to zip the file from outside this folder (so without using cd command) without including the folder dir. zip -r...
Read more >
How can I create a zip file without including the files parent ...
Just select the files and create a zip archive with the name of the parent folder. When you unzip it will ...
Read more >
how to create a zip file without including parent directory Linux
This vedio describe you how to create zip file without including its parent directory through command linehow to create a zip filehow to ......
Read more >
How To Zip A file Without Including Parent Directory
Solved: Hi, I managed to get Alteryx to automate zipping a file using Run Command using a batch file written with Alteryx but...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found