Jump to content

How to zip a full directory? Also ... unzip structure of an uploaded zip file.


adrianTNT

Recommended Posts

Can someone please point me in the right direction with this?

I am trying to create two things/codes.

 

- I have files placed like this in directories: "/files/103/", "/files/104/", "/files/105/"

The directories have multiple files and directories in them.

Is there a simple function to create a zip "104.zip" that contains all the files and folders in that directory keeping the directory structure?

 

- The other thing... users upload a zip by a form, is there a function to unzip an uploaded zip in a given directory (files/104/) keeping the directory structure from the zip?

 

Maybe there is a class or something for this?

Any ideas? Thank you.

Link to comment
Share on other sites

I found many examples for the unzip thing, but the 1st issue remains, I didn't find a code sample to zip all files and folders from one given location. I tried 6-7 versions, most of them link to external files or to 10 other libraries.

I do not know why people complicate things with thousands of lines, all I want is to zip a folder :(

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.