如何列出在C#中的.zip文件夹的内容? [英] How to list the contents of a .zip folder in c#?

查看:618
本文介绍了如何列出在C#中的.zip文件夹的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How to 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.

样code来读取一个zip:

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...
    }
}

这篇关于如何列出在C#中的.zip文件夹的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆