content inside zip file

2020-02-05 10:05发布

how to find list of files inside zip file without unzipping it in c#.

标签: c# .net zip
2条回答
霸刀☆藐视天下
2楼-- · 2020-02-05 10:46

With sharpziplib:

ZipInputStream zip = new ZipInputStream(File.OpenRead(path));
ZipEntry item;
while ((item = zip.GetNextEntry()) != null)
{
    Console.WriteLine(item.Name);
}
查看更多
老娘就宠你
3楼-- · 2020-02-05 10:53

There is a simple way to do this with sharpziplib :

        using (var zipFile = new ZipFile(@"C:\Test.zip"))
        {
            foreach (ZipEntry entry in zipFile)
            {
                Console.WriteLine(entry.Name);
            }
        }
查看更多
登录 后发表回答