C# ZipArchiveEntry FullName

Description

ZipArchiveEntry FullName Gets the relative path of the entry in the zip archive.

Syntax

ZipArchiveEntry.FullName has the following syntax.


public string FullName { get; private set; }

Example

The following example shows how to iterate through the contents of a .zip file, and extract files that contain the .txt extension.


using System;/*  w ww  .  j  a  v  a 2s  . c  om*/
using System.IO;
using System.IO.Compression;

class Program
{
    static void Main(string[] args)
    {
        string zipPath = @"c:\example\start.zip";
        string extractPath = @"c:\example\extract";

        using (ZipArchive archive = ZipFile.OpenRead(zipPath))
        {
            foreach (ZipArchiveEntry entry in archive.Entries)
            {
                if (entry.FullName.EndsWith(".txt", StringComparison.OrdinalIgnoreCase))
                {
                    entry.ExtractToFile(Path.Combine(extractPath, entry.FullName));
                }
            }
        } 
    }
}




















Home »
  C# Tutorial »
    System.IO.Compression »




DeflateStream
GZipStream
ZipArchive
ZipArchiveEntry
ZipFile
ZipFileExtensions