![]() |
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
(Tcl) 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.
load ./chilkat.dll set success 0 set success 0 # Open an existing ZIP archive. set zip [new_CkZip] set success [CkZip_OpenZip $zip "example.zip"] if {$success == 0} then { puts [CkZip_lastErrorText $zip] delete_CkZip $zip exit } set entry [new_CkZipEntry] # ------------------------------------------------------------ # Find the first .png file in the ZIP archive. set success [CkZip_EntryMatching $zip "*.png" $entry] if {$success == 1} then { puts "Found PNG file:" puts " [CkZipEntry_fileName $entry]" puts } # ------------------------------------------------------------ # 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. set success [CkZip_EntryMatching $zip "docs/*" $entry] if {$success == 1} then { puts "First matching docs entry:" puts " [CkZipEntry_fileName $entry]" puts " IsDirectory = [CkZipEntry_get_IsDirectory $entry]" puts } # ------------------------------------------------------------ # Find the first JSON file anywhere in the ZIP archive. set success [CkZip_EntryMatching $zip "*.json" $entry] if {$success == 1} then { puts "Found JSON file:" puts " [CkZipEntry_fileName $entry]" puts } # ------------------------------------------------------------ # 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. CkZip_CloseZip $zip puts "Done." delete_CkZip $zip delete_CkZipEntry $entry |
||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.