Chilkat HOME Android™ ASP Visual Basic VB.NET C# iOS (IPhone) Objective-C C++ C Unicode C++ Unicode C MFC Delphi DLL Delphi ActiveX FoxPro Java Perl PHP Extension PHP ActiveX Python PowerShell Ruby SQL Server VBScript
Create Zip Excluding Files Matching PatternsHow to create a .zip archive excluding (skipping) files that match a set of wildcarded patterns. Download: Chilkat .NET Assemblies Dim zip As New Chilkat.Zip() Dim success As Boolean ' Any string unlocks the component for the 1st 30-days. success = zip.UnlockComponent("Anything for 30-day trial") If (success <> true) Then MsgBox(zip.LastErrorText) Exit Sub End If success = zip.NewZip("test.zip") If (success <> true) Then MsgBox(zip.LastErrorText) Exit Sub End If ' Create a string array object with our set of filename patterns ' to be excluded: Dim sa As New Chilkat.StringArray() sa.Append("*.bak") sa.Append("*.tmp") ' Tell the zip object to use these exclusions: zip.SetExclusions(sa) ' Append a directory tree. The AppendFiles does ' not read the file contents or append them to the zip ' object in memory. It simply appends references ' to the files so that when WriteZip (or WriteZipAndClose, ' or WriteExe, etc.) is called, the files are compressed ' and encrypted. Dim recurse As Boolean recurse = true zip.AppendFiles("c:/temp/a/*",recurse) success = zip.WriteZipAndClose() If (success <> true) Then MsgBox(zip.LastErrorText) Exit Sub End If MsgBox("Zip Created!") |
© 2000-2013 Chilkat Software, Inc. All Rights Reserved.