RemoveSelectedEntries Method (selectionCriteria, directoryPathInArchive)

DotNetZip

Ionic Zip Library v1.9.1.6 RemoveSelectedEntries Method (selectionCriteria, directoryPathInArchive)
ReferenceIonic.ZipZipFileRemoveSelectedEntries(String, String)
Remove entries from the zipfile by specified criteria, and within the specified path in the archive.
Declaration Syntax
C# Visual Basic Visual C++
public int RemoveSelectedEntries(
	string selectionCriteria,
	string directoryPathInArchive
)
Public Function RemoveSelectedEntries ( _
	selectionCriteria As String, _
	directoryPathInArchive As String _
) As Integer
public:
int RemoveSelectedEntries(
	String^ selectionCriteria, 
	String^ directoryPathInArchive
)
Parameters
selectionCriteria (String)
the string that specifies which entries to select
directoryPathInArchive (String)
the directory in the archive from which to select entries. If null, then all directories in the archive are used.
Return Value
the number of entries removed
Remarks

This method allows callers to remove the collection of entries from the zipfile that fit the specified criteria. The criteria are described in a string format, and can include patterns for the filename; constraints on the size of the entry; constraints on the last modified, created, or last accessed time for the file described by the entry; or the attributes of the entry.

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

This method is intended for use with a ZipFile that has been read from storage. When creating a new ZipFile, this method will work only after the ZipArchive has been Saved to the disk (the ZipFile class subsequently and implicitly reads the Zip archive from storage.) Calling SelectEntries on a ZipFile that has not yet been saved will deliver undefined results.

Examples
CopyC#
using (ZipFile zip1 = ZipFile.Read(ZipFileName))
{
    // remove all entries from prior to Jan 1, 2008
    zip1.RemoveEntries("mtime < 2008-01-01", "documents");
    // a call to ZipFile.Save will make the modifications permanent
    zip1.Save();
}
CopyVB.NET
Using zip As ZipFile = ZipFile.Read(ZipFileName)
    ' remove all entries from prior to Jan 1, 2008
    zip1.RemoveEntries("mtime < 2008-01-01", "documents")
    ' a call to ZipFile.Save will make the modifications permanent
    zip1.Save
End Using
Exceptions
Exception Condition
Exception Thrown if selectionCriteria has an invalid syntax.

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