Xceed .NET Libraries Documentation
Welcome to Xceed Data Manipulation Compoents for .NET and .NET Standard / Task-Based Help / Zip and streaming capabilities / Listing / Listing the contents of a zip file

In This Topic
    Listing the contents of a zip file
    In This Topic

    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:

    • Declare an array of QuickZipItem objects that will contain the result of the call to the GetZipContents method. 

    • Iterate through the array of QuickZipItem objects to retrieve information on each QuickZipItem object it contains.

    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:

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