Announcement

Collapse
No announcement yet.

Zlib.dll - Can I zip a folder (only including the containing folder as a path)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Zlib.dll - Can I zip a folder (only including the containing folder as a path)

    I can successfully use zlib to unzip "*.docx files" files and these contain several folders.

    After editing the files I cannot find by the zlib Header file how to re-zip the files including a single folder as the path

  • #2
    When I wrote a utility (called dirzip) to compress all subdirectories into a single zip file (each subdirectory in it's own zip file), I used a dll called litezip. I'm not sure exactly where I got it, but I'm pretty sure a post on the forums here pointed me in it's direction. I think you might have good luck trying that dll if the docx format uses actual zip files (I've never checked, so can't say for sure), though if it's using zlib compression like the pdf files do, then that won't help you any, but I thought I'd mention it here in case you could use it instead.
    http://www.softcon.com]


    for hosting/internet


    access.

    Comment


    • #3
      Sorry I forgot to reply with the solution:

      If the first file to be zipped contains a path whose final folder is the one that you wish use as the restore folder only for all the files then the first file:

      Code:
      AddToZipEx(inputpath & infilename, outputpath & outfilename, %ZIP_REL_PATH)
      However if the first file contains one or more sub folders then the first two files should be:

      Code:
      AddToZipEx(inputpath, outputpath & outfilename, %ZIP_REL_PATH)
      where "inputpath" is a path whose last folder is the required folder - there should be no filename.

      followed by the following for each subsequent file whose path may or may not contain subfolders.

      Code:
      AddToZipEx(inputpath & infilename, outputpath & outfilename, %ZIP_REL_PATH)
      The final file should be coded as:

      Code:
      AddToZipEx(inputpath & inline, outputpath & outfilename, %ZIP_REL_PATH + %ZIP_CLOSE)
      The current $INCLUDE "zlib.inc" will flag an error at one point (I think when closing the zip file) but I ignore it!

      Last edited by Robert Wallace; 14 Aug 2018, 07:21 AM. Reason: [\QUOTE] didn't display a Glyph.

      Comment

      Working...
      X