Xceed .NET Libraries Documentation
Listing the contents of a zip file

Welcome to Xceed .NET, .NET Standard and Xamarin Libraries! > Task-Based Help > Zip and streaming capabilities > Listing > Listing the contents of a zip file

This topic demonstrates how to list the contents of a zip file using the static GetZipContents method of the QuickZip class.

Basic steps

To list the contents of a zip file, the following steps must be performed:

Demonstration

This example demonstrates how to list the contents of a zip file.

VB.NET Copy Code

Imports Xceed.Zip

Dim items As QuickZipItem()
Dim item As QuickZipItem

items = QuickZip.GetZipContents( "c:\test.zip", "*" )
For Each item In items
   Console.WriteLine( item.Name )
Next

C# Copy Code

using Xceed.Zip

QuickZipItem[] items = QuickZip.GetZipContents( @"c:\test.zip", "*" );

foreach( QuickZipItem item in items)
{
   Console.WriteLine( item.Name );
}

Remarks

Zip files are case sensitive therefore the string passed in the fileMasks parameter, will be used "as-is". For example, if a zip file contains a file named "FILE.TXT" and "file.txt" is passed to the fileMasks parameter, "FILE.TXT" will not be retrieved.

Things you should consider

The main questions you should ask yourself when listing the contents of a zip file are: