如何在C#中列出.zip文件夹的内容? [英] How can I list the contents of a .zip folder in c#?
本文介绍了如何在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...
}
}
这篇关于如何在C#中列出.zip文件夹的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文