Export (0) Print
Expand All

ZipArchiveEntry.FullName Property

.NET Framework 4.5

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

Namespace:  System.IO.Compression
Assembly:  System.IO.Compression (in System.IO.Compression.dll)

public string FullName { get; private set; }

Property Value

Type: System.String
The relative path of the entry in the zip archive.

The FullName property contains the relative path, including the subdirectory hierarchy, of an entry in a zip archive. (In contrast, the Name property contains only the name of the entry and does not include the subdirectory hierarchy.) For example, if you create two entries in a zip archive by using the CreateEntryFromFile method and provide NewEntry.txt as the name for the first entry and AddedFolder\\NewEntry.txt for the second entry, both entries will have NewEntry.txt in the Name property. The first entry will also have NewEntry.txt in the FullName property, but the second entry will have AddedFolder\\NewEntry.txt in the FullName property.

You can specify any string as the path of an entry, including strings that specify invalid and absolute paths. Therefore, the FullName property might contain a value that is not correctly formatted. An invalid or absolute path might result in an exception when you extract the contents of the zip archive.

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

using System;
using System.IO;
using System.IO.Compression;

namespace ConsoleApplication1
    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));

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1

Windows Phone 8.1, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft