Xceed .NET Libraries Documentation
Removing files from a zip file

Welcome to Xceed .NET, .NET Standard and Xamarin Libraries! > Task-Based Help > Zip and streaming capabilities > Deleting > Removing files from a zip file

This topic demonstrates how to remove file(s) from within a zip file using the static Remove method of the QuickZip class.

Remove method

The Remove method can be used to remove one or more files and folders from within a zip file either recursively or not.

Demonstration

The following example demonstrates how to remove all files that begin with "xceed" from a zip file that contains various files.

VB.NET Copy Code

Imports Xceed.Zip

QuickZip.Remove( "d:\test\files.zip", true, "xceed*" )

C# Copy Code

using Xceed.Zip;

QuickZip.Remove( @"d:\test\files.zip", true, "xceed*" );

Remarks

Note that the filesToRemove parameter of the Remove method cannot be null otherwise an ArgumentNullException exception will be thrown.

Things you should consider

The main questions you should ask yourself when removing files from a zip file are:

  • Do you want to do more complex zip file operations? Use the other classes defined within the Xceed.Zip namespace.