![]() |
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 Through ZIP Entries Using EntryAt and ZipEntry.GetNextSee more Zip ExamplesThis example demonstrates how to iterate through all entries in a ZIP archive using:
The example prints each ZIP entry's stored filename and whether the entry is a file or directory. This approach is useful when sequentially processing ZIP entries without repeatedly calling Suppose the ZIP archive contains: The example iterates through each entry in the order stored within the ZIP archive.
integer li_rc integer li_Success oleobject loo_Zip oleobject loo_Entry li_Success = 0 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 // Open an existing ZIP archive. li_Success = loo_Zip.OpenZip("c:/temp/example.zip") if li_Success = 0 then Write-Debug loo_Zip.LastErrorText destroy loo_Zip return end if // A ZIP archive may contain zero entries. if loo_Zip.NumEntries = 0 then Write-Debug "The ZIP archive is empty." loo_Zip.CloseZip() destroy loo_Zip return end if // ------------------------------------------------------------ // Get the first ZIP entry. // // EntryAt(0,entry) initializes the ZipEntry object so that // it represents the first entry in the ZIP archive. // loo_Entry = create oleobject li_rc = loo_Entry.ConnectToNewObject("Chilkat.ZipEntry") li_Success = loo_Zip.EntryAt(0,loo_Entry) if li_Success = 0 then Write-Debug loo_Zip.LastErrorText destroy loo_Zip destroy loo_Entry return end if // ------------------------------------------------------------ // Iterate through all ZIP entries. // // GetNext updates the same ZipEntry object so that it // represents the next entry in the ZIP archive. // do while (li_Success = 1) if loo_Entry.IsDirectory = 1 then Write-Debug "[Directory] " + loo_Entry.FileName else Write-Debug "[File] " + loo_Entry.FileName end if // Advance to the next entry. li_Success = loo_Entry.GetNext() loop loo_Zip.CloseZip() Write-Debug "Done." destroy loo_Zip destroy loo_Entry |
||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.