Ionic Zip Library v1.9.1.6
AddSelectedFiles Method (selectionCriteria, directoryOnDisk, recurseDirectories)
Adds to the ZipFile a set of files from the specified directory on disk,
that conform to the specified criteria.
Declaration Syntax
Remarks
This method selects files from the the specified disk directory matching the specified selection criteria, and adds them to the ZipFile. If recurseDirectories is true, files are also selected from subdirectories.
The full directory structure in the filesystem is reproduced on the entries added to 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 *.csv files in the "files" directory, or any
subdirectory, that have been saved since 2009 February 14th.
CopyC#
using (ZipFile zip = new ZipFile()) { // Use a compound expression in the selectionCriteria string. zip.AddSelectedFiles("name = *.csv and mtime > 2009-02-14", "files", true); zip.Save(PathToZipArchive); }
CopyVB.NET
Using zip As ZipFile = New ZipFile() ' Use a compound expression in the selectionCriteria string. zip.AddSelectedFiles("name = *.csv and mtime > 2009-02-14", "files", true) zip.Save(PathToZipArchive) End Using
Examples
This example zips up all files in the current working
directory, and all its child directories, except those in
the excludethis subdirectory.
CopyVB.NET
Using Zip As ZipFile = New ZipFile(zipfile) Zip.AddSelectedFfiles("name != 'excludethis\*.*'", datapath, True) Zip.Save() End Using