Ionic Zip Library v1.9.1.6
AddSelectedFiles Method (selectionCriteria, recurseDirectories)
Adds to the ZipFile a set of files from the disk that conform to the
specified criteria, optionally recursing into subdirectories.
Declaration Syntax
Remarks
This method selects files from the the current working directory matching the specified criteria, and adds them to the ZipFile. If recurseDirectories is true, files are also selected from subdirectories, and the directory structure in the filesystem is reproduced in the zip archive, rooted at the current working directory.
Using this method, the full path of the selected files is included in the entries added into the zip archive. If you don't want this behavior, use one of the overloads of this method that allows the specification of a directoryInArchive.
For details on the syntax for the selectionCriteria parameter, see AddSelectedFiles(String).
Examples
This example zips up all *.xml files in the current working directory, or any
subdirectory, that are larger than 1mb.
CopyC#
using (ZipFile zip = new ZipFile()) { // Use a compound expression in the selectionCriteria string. zip.AddSelectedFiles("name = *.xml and size > 1024kb", true); zip.Save(PathToZipArchive); }
CopyVB.NET
Using zip As ZipFile = New ZipFile() ' Use a compound expression in the selectionCriteria string. zip.AddSelectedFiles("name = *.xml and size > 1024kb", true) zip.Save(PathToZipArchive) End Using