![]() |
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
(AutoIt) Find ZIP Entries Matching a Wildcard Pattern Using EntryMatchingSee more Zip Examples This example demonstrates how to use the The wildcard character This method is useful for:
Suppose the ZIP archive contains: Notice that the ZIP archive contains an explicit directory entry named When searching with the pattern The example searches for:
Note: This example requires Chilkat v11.0.0 or greater.
Local $bSuccess = False $bSuccess = False ; Open an existing ZIP archive. $oZip = ObjCreate("Chilkat.Zip") $bSuccess = $oZip.OpenZip("example.zip") If ($bSuccess = False) Then ConsoleWrite($oZip.LastErrorText & @CRLF) Exit EndIf $oEntry = ObjCreate("Chilkat.ZipEntry") ; ------------------------------------------------------------ ; Find the first .png file in the ZIP archive. $bSuccess = $oZip.EntryMatching("*.png",$oEntry) If ($bSuccess = True) Then ConsoleWrite("Found PNG file:" & @CRLF) ConsoleWrite(" " & $oEntry.FileName & @CRLF) ConsoleWrite("" & @CRLF) EndIf ; ------------------------------------------------------------ ; Find the first entry beneath the docs directory. ; ; Note: ZIP archives may optionally contain explicit directory ; entries such as "docs/" in addition to file entries. ; Therefore, the first matching entry could be the directory ; itself rather than a file contained within the directory. $bSuccess = $oZip.EntryMatching("docs/*",$oEntry) If ($bSuccess = True) Then ConsoleWrite("First matching docs entry:" & @CRLF) ConsoleWrite(" " & $oEntry.FileName & @CRLF) ConsoleWrite(" IsDirectory = " & $oEntry.IsDirectory & @CRLF) ConsoleWrite("" & @CRLF) EndIf ; ------------------------------------------------------------ ; Find the first JSON file anywhere in the ZIP archive. $bSuccess = $oZip.EntryMatching("*.json",$oEntry) If ($bSuccess = True) Then ConsoleWrite("Found JSON file:" & @CRLF) ConsoleWrite(" " & $oEntry.FileName & @CRLF) ConsoleWrite("" & @CRLF) EndIf ; ------------------------------------------------------------ ; The matching is performed against the full stored ZIP path. ; For example: ; ; docs/readme.txt ; images/logo.png ; data/config/settings.json ; ; The wildcard '*' matches zero or more characters. $oZip.CloseZip ConsoleWrite("Done." & @CRLF) |
||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.