![]() |
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) Exclude Multiple Directories When Adding Files to a ZIPSee more Zip Examples This example demonstrates how to use the The This is useful for excluding directories such as:
Call Suppose the local filesystem contains: After excluding The resulting ZIP archive contains: Note: This example requires Chilkat v11.0.0 or greater.
Use ChilkatAx-win32.pkg Procedure Test Boolean iSuccess Handle hoZip Boolean iRecurse Boolean iSaveExtraPath Boolean iArchiveOnly Boolean iIncludeHidden Boolean iIncludeSystem String sTemp1 Move False To iSuccess Move False To iSuccess Get Create (RefClass(cComChilkatZip)) To hoZip If (Not(IsComObjectCreated(hoZip))) Begin Send CreateComObject of hoZip End Get ComNewZip Of hoZip "project.zip" To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoZip To sTemp1 Showln sTemp1 Procedure_Return End // Exclude several directory names. // // Any directory matching one of these names will be skipped // during recursive file appending. Send ComExcludeDir To hoZip "bin" Send ComExcludeDir To hoZip "obj" Send ComExcludeDir To hoZip ".git" Send ComExcludeDir To hoZip "node_modules" // Recursively append all files beneath c:/project. // // Because saveExtraPath = True, the ZIP paths will // include "project/" as the leading directory. Move True To iRecurse Move True To iSaveExtraPath Move False To iArchiveOnly Move True To iIncludeHidden Move False To iIncludeSystem Get ComAppendFilesEx Of hoZip "c:/project" iRecurse iSaveExtraPath iArchiveOnly iIncludeHidden iIncludeSystem To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoZip To sTemp1 Showln sTemp1 Procedure_Return End // Write the ZIP archive. Get ComWriteZipAndClose Of hoZip To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoZip To sTemp1 Showln sTemp1 Procedure_Return End Showln "ZIP archive created successfully." End_Procedure |
||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.