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).
using (ZipFile zip = new ZipFile()) { // Use a compound expression in the selectionCriteria string. zip.AddSelectedFiles("name = *.xml and size > 1024kb", true); zip.Save(PathToZipArchive); }
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