ZIP library

Xbase++ 2.0 Build 554 or later
Message
Author
User avatar
rdonnay
Site Admin
Posts: 4804
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: ZIP library

#11 Post by rdonnay »

Chilkat Zip does not have a specific maximum file size for unzipping files. It supports ZIP64 when writing to files, allowing for large zip files. The default value for the max size property is 0, which means any size file can be unzipped123.
This probably isn't an issue, but I wanted to make sure.
We need to zip 2 files of this size into a single ZIP file :
12/07/2024 04:12 AM 2,989,852,672 MN_DTR.cdx
12/07/2024 04:12 AM 9,370,020,798 mn_dtr.dbf

Due to the fact that Xbase++ 2.0 is 32-bit, is this a problem or does the Chilkat ActiveX control handle 64-bit operations independently?
The eXpress train is coming - and it has more cars.

User avatar
rdonnay
Site Admin
Posts: 4804
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: ZIP library

#12 Post by rdonnay »

Here is some code written by ChatGPT:

Code: Select all

#include "activex.ch"

PROCEDURE Main()

   // Initialize Chilkat ActiveX
   LOCAL oChilkatZip // AS OBJECT
   LOCAL cFolderPath // AS STRING
   LOCAL cZipFileName // AS STRING
   LOCAL oSuccess // AS LOGICAL

   // Create an instance of Chilkat Zip
   oChilkatZip := CreateObject("Chilkat.Zip")

   IF oChilkatZip == NIL
      ? "Failed to create Chilkat Zip object."
      RETURN
   ENDIF

  // // Unlock the component
   oSuccess := oChilkatZip:UnlockComponent("YourUnlockCode")
   IF !oSuccess
      ? "Chilkat component unlock failed!"
      ? oChilkatZip:LastErrorText
      RETURN
   ENDIF

   // Specify the folder to zip
   cFolderPath := "C:\Path\To\Your\Folder"
   cZipFileName := "C:\Path\To\Output\Archive.zip"

   // Create a new zip file
   oSuccess := oChilkatZip:NewZip(cZipFileName)
   IF !oSuccess
      ? "Failed to create new zip file."
      ? oChilkatZip:LastErrorText
      RETURN
   ENDIF

   // Add files from the folder to the zip
   oSuccess := oChilkatZip:AppendFiles(cFolderPath + "\*", 1) // 1 = include subdirectories
   IF !oSuccess
      ? "Failed to add files to zip."
      ? oChilkatZip:LastErrorText
      RETURN
   ENDIF

   // Write the zip file to disk
   oSuccess := oChilkatZip:WriteZipAndClose()
   IF oSuccess
      ? "Files successfully zipped to: " + cZipFileName
   ELSE
      ? "Failed to write zip file."
      ? oChilkatZip:LastErrorText
   ENDIF

RETURN
/*
Key Points:
Unlocking the Chilkat Component: Replace "YourUnlockCode" with the actual unlock key provided by Chilkat when you purchased or obtained a trial version.
Folder Path: Modify cFolderPath to the directory containing files you want to zip.
Output File Name: cZipFileName specifies the name and location of the output ZIP file.
Dependencies:
Chilkat ActiveX Library: Download and install from the Chilkat website.
Xbase++ ActiveX Support: Ensure you have the ActiveX extension included in your Xbase++ setup.
Run the program, and it will zip all files in the specified folder (including subdirectories, if enabled). Let me know if you need help with configuration or troubleshooting!
*/
The eXpress train is coming - and it has more cars.

k-insis
Posts: 125
Joined: Fri Jan 28, 2011 4:07 am

Re: ZIP library

#13 Post by k-insis »

12GB is no issues as long OS can read data and serve chunks of it to software and not an ancient binaries are used so imho you are pretty safe with CK control.

Mind almost all .zip compressor are single thread-single core and many still don't use modern code ; so speed of compression MBps will vary.

If time is essential you might create .tar.gz with "pigz" as compress util as it can use all CPU cores on machine if time for compression is issue.
There win32/win64 ports of both available . Output is of course .tar.gz .


rdonnay wrote: Sat Dec 07, 2024 10:34 am
Chilkat Zip does not have a specific maximum file size for unzipping files. It supports ZIP64 when writing to files, allowing for large zip files. The default value for the max size property is 0, which means any size file can be unzipped123.
This probably isn't an issue, but I wanted to make sure.
We need to zip 2 files of this size into a single ZIP file :
12/07/2024 04:12 AM 2,989,852,672 MN_DTR.cdx
12/07/2024 04:12 AM 9,370,020,798 mn_dtr.dbf

Due to the fact that Xbase++ 2.0 is 32-bit, is this a problem or does the Chilkat ActiveX control handle 64-bit operations independently?

Post Reply