AddSelectedFiles Method (selectionCriteria, directoryOnDisk)

DotNetZip

Ionic Zip Library v1.9.1.6 AddSelectedFiles Method (selectionCriteria, directoryOnDisk)
ReferenceIonic.ZipZipFileAddSelectedFiles(String, String)
Adds to the ZipFile a set of files from a specified directory in the filesystem, that conform to the specified criteria.
Declaration Syntax
C# Visual Basic Visual C++
public void AddSelectedFiles(
	string selectionCriteria,
	string directoryOnDisk
)
Public Sub AddSelectedFiles ( _
	selectionCriteria As String, _
	directoryOnDisk As String _
)
public:
void AddSelectedFiles(
	String^ selectionCriteria, 
	String^ directoryOnDisk
)
Parameters
selectionCriteria (String)
The criteria for file selection
directoryOnDisk (String)
The name of the directory on the disk from which to select files.
Remarks

This method selects files that conform to the specified criteria, from the the specified directory on disk, and adds them to the ZipFile. The search does not recurse into subdirectores.

Using this method, the full filesystem path of the files on disk is reproduced on the entries added to the zip file. If you don't want this behavior, use one of the other overloads of this method.

For details on the syntax for the selectionCriteria parameter, see AddSelectedFiles(String).

Examples
This example zips up all *.xml files larger than 1mb in the directory given by "d:\rawdata".
CopyC#
using (ZipFile zip = new ZipFile())
{
    // Use a compound expression in the selectionCriteria string.
    zip.AddSelectedFiles("name = *.xml  and  size > 1024kb", "d:\\rawdata");
    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", "d:\rawdata)
    zip.Save(PathToZipArchive)
End Using

Assembly: Ionic.Zip (Module: Ionic.Zip) Version: 1.9.1.8 (1.9.1.8)