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).
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); }
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
Using Zip As ZipFile = New ZipFile(zipfile) Zip.AddSelectedFfiles("name != 'excludethis\*.*'", datapath, True) Zip.Save() End Using