如何在C#中列出.zip文件夹的内容?

问题描述:

如何在C#中列出压缩文件夹的内容?例如,如何知道压缩文件夹中包含多少个项目,它们的名称是什么?

How can I list the contents of a zipped folder in C#? For example how to know how many items are contained within a zipped folder, and what is their name?

DotNetZip -Zip文件中的操作.NET语言

DotNetZip - Zip file manipulation in .NET languages

DotNetZip是一个易于使用的小型类库,用于处理.zip文件.它可以使以VB.NET,C#和任何.NET语言编写的.NET应用程序能够轻松创建,读取和更新zip文件.

DotNetZip is a small, easy-to-use class library for manipulating .zip files. It can enable .NET applications written in VB.NET, C#, any .NET language, to easily create, read, and update zip files.

阅读邮政编码的示例代码:

sample code to read a zip:

using (var zip = ZipFile.Read(PathToZipFolder))
{
    int totalEntries = zip.Entries.Count; 
    foreach (ZipEntry e in zip.Entries)
    {
        e.FileName ...
        e.CompressedSize ...
        e.LastModified...
    }
}