Listing ZIP contents
suggest changeThis snippet will list all the filenames of a zip archive. The filenames are relative to the zip root.
using (FileStream fs = new FileStream("archive.zip", FileMode.Open)) using (ZipArchive archive = new ZipArchive(fs, ZipArchiveMode.Read)) { for (int i = 0; i < archive.Entries.Count; i++) { Console.WriteLine($"{i}: {archive.Entries[i]}"); } }
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents