![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java JavaScript Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PowerBuilder) Iterate Over ZIP Entries Using EntryAt This example demonstrates how to use the The This is useful for:
Suppose the ZIP archive contains: The example loops through all ZIP entries and prints information about each entry. Note: This example requires Chilkat v11.0.0 or greater.
integer li_rc integer li_Success oleobject loo_Zip integer li_NumEntries oleobject loo_Entry integer i li_Success = 0 li_Success = 0 // Open an existing ZIP archive. loo_Zip = create oleobject li_rc = loo_Zip.ConnectToNewObject("Chilkat.Zip") if li_rc < 0 then destroy loo_Zip MessageBox("Error","Connecting to COM object failed") return end if li_Success = loo_Zip.OpenZip("example.zip") if li_Success = 0 then Write-Debug loo_Zip.LastErrorText destroy loo_Zip return end if // Get the total number of entries in the ZIP archive. li_NumEntries = loo_Zip.NumEntries Write-Debug "Number of ZIP entries = " + string(li_NumEntries) // Create a ZipEntry object that will be reused // for each entry retrieved by EntryAt. loo_Entry = create oleobject li_rc = loo_Entry.ConnectToNewObject("Chilkat.ZipEntry") // Iterate over all ZIP entries. i = 0 do while i < li_NumEntries // Retrieve the entry at index i. li_Success = loo_Zip.EntryAt(i,loo_Entry) if li_Success = 0 then Write-Debug loo_Zip.LastErrorText destroy loo_Zip destroy loo_Entry return end if Write-Debug "Entry " + string(i) Write-Debug " FileName: " + loo_Entry.FileName Write-Debug " Uncompressed Length: " + string(loo_Entry.UncompressedLength) Write-Debug " Compressed Length: " + string(loo_Entry.CompressedLength) Write-Debug "" i = i + 1 loop // Sample output: // // Entry 0 // FileName: docs/readme.txt // Uncompressed Length: 1204 // Compressed Length: 512 // // Entry 1 // FileName: images/logo.png // Uncompressed Length: 84211 // Compressed Length: 84102 // loo_Zip.CloseZip() Write-Debug "Done." destroy loo_Zip destroy loo_Entry |
||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.