RemoveEntry Method (fileName)

DotNetZip

Ionic Zip Library v1.9.1.6 RemoveEntry Method (fileName)
ReferenceIonic.ZipZipFileRemoveEntry(String)
Removes the ZipEntry with the given filename from the zip archive.
Declaration Syntax
C# Visual Basic Visual C++
public void RemoveEntry(
	string fileName
)
Public Sub RemoveEntry ( _
	fileName As String _
)
public:
void RemoveEntry(
	String^ fileName
)
Parameters
fileName (String)
The name of the file, including any directory path, to remove from the zip. The filename match is not case-sensitive by default; you can use the CaseSensitiveRetrieval property to change this behavior. The pathname can use forward-slashes or backward slashes.
Remarks

After calling RemoveEntry, the application must call Save to make the changes permanent.

Examples
This example shows one way to remove an entry with a given filename from an existing zip archive.
CopyC#
String zipFileToRead= "PackedDocuments.zip";
string candidate = "DatedMaterial.xps";
using (ZipFile zip = ZipFile.Read(zipFileToRead))
{
  if (zip.EntryFilenames.Contains(candidate))
  {
    zip.RemoveEntry(candidate);
    zip.Comment= String.Format("The file '{0}' has been removed from this archive.",
                               Candidate);
    zip.Save();
  }
}
CopyVB.NET
Dim zipFileToRead As String = "PackedDocuments.zip"
Dim candidate As String = "DatedMaterial.xps"
Using zip As ZipFile = ZipFile.Read(zipFileToRead)
    If zip.EntryFilenames.Contains(candidate) Then
        zip.RemoveEntry(candidate)
        zip.Comment = String.Format("The file '{0}' has been removed from this archive.", Candidate)
        zip.Save
    End If
End Using
Exceptions
Exception Condition
InvalidOperationException Thrown if the ZipFile is not updatable.
ArgumentException Thrown if a ZipEntry with the specified filename does not exist in the ZipFile.

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