Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
Create a Zip While Excluding Files Matching a PatternDownloads: MS Windows Visual C/C++ Libraries Linux/CentOS C/C++ Libraries MAC OS X C/C++ Libraries Solaris C/C++ Libraries C++ Builder Libraries Demonstrates how to create a Zip while excluding files matching a pattern. // Zip Compression C++ Source Code to // add an entire directory tree to a Zip // while excluding files matching a pattern. // #include "stdafx.h" #include "CkZip.h" #include "CkZipEntry.h" #include "CkStringArray.h" int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // Unlock the Zip product. // This only needs to be done once when the first CkZip object // is instantiated. CkZip zip; zip.UnlockComponent("unlockCode"); // Create a new Zip and append files and directories recursively. zip.NewZip("myZip.zip"); // Exclude all of these types of files. CkStringArray sArray; sArray.Append("*.obj"); sArray.Append("*.exe"); sArray.Append("*.ncb"); sArray.Append("*.db"); // Add the exlusions. zip.SetExclusions(&sArray); // Also exclude directories named "Sounds", "Debug" and "Release", wherever found. zip.ExcludeDir("Debug"); zip.ExcludeDir("Release"); zip.ExcludeDir("Sounds"); // Append the files, excluding everything we've specified. zip.AppendFiles("./Tree/*",true,0); zip.WriteZipAndClose(0); return 0; }
|
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.