Skip to content
Advertisement

zip file made by php shows wrong folder structure in js-dos but correct in windows

I am working on a project which requires me to collect several files from the server, zip them, and mount the zip as a drive with js-dos.

Everything works ‘correctly’. During testing I manually made a zip file in windows and the code ran. For the final test I tried to mount the php generated zip but the folder structure is strange when doing DIR in js-dos.

I should have a single folder with several files in it. Instead there are several of the same folders with a single file inside.

The thing that breaks my brain is that when I open the file in winRAR it’s correct, but in js-dos it’s suddenly different.

Here is my code, it’s nothing fancy:

JavaScript

I’m guessing that windows over looks something that dos doesn’t. zip files made with winRAR are ok, but the ones generated by this code are strange.

I want to generate the .zip in php not by shell command. Can anyone help me figure this out?

Advertisement

Answer

Maybe js-dos cannot automatically create intermediate directories, you could try the code below to add intermediate directories to zip file.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement