how to find list of files inside zip file without unzipping it in c#.
Asked
Active
Viewed 6,520 times
5
-
possible duplicate of [How do I ZIP a file in C#, using no 3rd-party APIs?](http://stackoverflow.com/questions/940582/how-do-i-zip-a-file-in-c-using-no-3rd-party-apis) – egrunin Jul 03 '10 at 18:55
2 Answers
8
With sharpziplib:
ZipInputStream zip = new ZipInputStream(File.OpenRead(path));
ZipEntry item;
while ((item = zip.GetNextEntry()) != null)
{
Console.WriteLine(item.Name);
}

Marc Gravell
- 1,026,079
- 266
- 2,566
- 2,900
-
-
@Niraj Choubey: yes, with some other ZIP library (like http://dotnetzip.codeplex.com/) ..... or you have to re-create the whole ZIP code yourself just to peek inside the ZIP file.... – marc_s Jul 03 '10 at 07:55
-
maybe the `System.IO` will support ZIP archives natively in a future version of the .NET framework - see http://blogs.msdn.com/b/bclteam/archive/2010/06/28/working-with-zip-files-in-net.aspx – marc_s Jul 04 '10 at 07:19
2
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);
}
}

user2776545
- 21
- 1