![]() |
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
(DataFlex) Iterate Through Matching ZIP Entries Using EntryMatching and ZipEntry.GetNextMatchSee more Zip ExamplesThis example demonstrates how to iterate through ZIP entries matching a wildcard pattern using:
The wildcard character The example searches for all entries beneath the Suppose the ZIP archive contains: The wildcard pattern: Matches: Note that ZIP archives may optionally contain separate directory entries. Therefore, the first matching entry may be the directory entry
Use ChilkatAx-win32.pkg Procedure Test Boolean iSuccess Handle hoZip Variant vEntry Handle hoEntry String sTemp1 Boolean bTemp1 Move False To iSuccess Get Create (RefClass(cComChilkatZip)) To hoZip If (Not(IsComObjectCreated(hoZip))) Begin Send CreateComObject of hoZip End // Open an existing ZIP archive. Get ComOpenZip Of hoZip "c:/temp/sample.zip" To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoZip To sTemp1 Showln sTemp1 Procedure_Return End // ------------------------------------------------------------ // Find the first ZIP entry matching the wildcard pattern: // // docs/* // // Matching is performed against the full stored ZIP path. // Get Create (RefClass(cComChilkatZipEntry)) To hoEntry If (Not(IsComObjectCreated(hoEntry))) Begin Send CreateComObject of hoEntry End Get pvComObject of hoEntry to vEntry Get ComEntryMatching Of hoZip "docs/*" vEntry To iSuccess If (iSuccess = False) Begin Showln "No matching entries found." Send ComCloseZip To hoZip Procedure_Return End // ------------------------------------------------------------ // Iterate through all matching entries. // // GetNextMatch updates the same ZipEntry object so that // it represents the next matching entry. // While (iSuccess = True) Get ComIsDirectory Of hoEntry To bTemp1 If (bTemp1 = True) Begin Get ComFileName Of hoEntry To sTemp1 Showln "[Directory] " sTemp1 End Else Begin Get ComFileName Of hoEntry To sTemp1 Showln "[File] " sTemp1 End // Advance to the next matching entry. Get ComGetNextMatch Of hoEntry "docs/*" To iSuccess Loop Send ComCloseZip To hoZip Showln "Done." End_Procedure |
||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.