Cocoa Objective-C Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CUnicode C++Unicode CMFCDelphi DLLDelphi ActiveXFoxProJavaPerlPHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

Objective-C Examples

Bounced Email
Digital Certificates
Digital Signatures
DKIM / DomainKey
DSA
Email Object
Encryption
FTP
HTML Conversion
HTTP
IMAP
MHT / HTML Email
POP3
RSA
MIME
SMTP
Socket
SOCKS Proxy
Spider
SSH Key
SSH
SFTP
Tar
Upload
XML
XMP
Zip


More Examples...
Amazon S3
NTLM
RSS
Atom
PPMD
Deflate
Bzip2
LZW
Diffie-Hellman
Bz2
Character Encoding
CSV

 

 

 

 

 

 

 

 

Create Zip Excluding Files Matching Patterns

How to create a .zip archive excluding (skipping) files that match a set of wildcarded patterns.

Download: Chilkat Cocoa Objective-C Libraries

NSMutableString *strOutput = [NSMutableString stringWithCapacity:1000];

CkoZip *zip = [[[CkoZip alloc] init] autorelease];

BOOL success;

//  Any string unlocks the component for the 1st 30-days.
success = [zip UnlockComponent: @"Anything for 30-day trial"];
if (success != YES) {
    [strOutput appendString: zip.LastErrorText];
    [strOutput appendString: @"\n"];
    self.mainTextField.stringValue = strOutput;
    return;
}

success = [zip NewZip: @"test.zip"];
if (success != YES) {
    [strOutput appendString: zip.LastErrorText];
    [strOutput appendString: @"\n"];
    self.mainTextField.stringValue = strOutput;
    return;
}

//  Create a string array object with our set of filename patterns
//  to be excluded:
CkoStringArray *sa = [[[CkoStringArray alloc] init] autorelease];
[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.
BOOL recurse;
recurse = YES;
[zip AppendFiles: @"/temp/a/*" recurse: recurse];

success = [zip WriteZipAndClose];
if (success != YES) {
    [strOutput appendString: zip.LastErrorText];
    [strOutput appendString: @"\n"];
    self.mainTextField.stringValue = strOutput;
    return;
}

[strOutput appendString: @"Zip Created!"];
[strOutput appendString: @"\n"];

self.mainTextField.stringValue = strOutput;



© 2000-2013 Chilkat Software, Inc. All Rights Reserved.