c# - How to get the files from the hierarchy of Zip Folder -


i have directory structure this: a.zip - - - 1.dat 2.dat

i want read files 1.dat , 2.dat inside directory hierarchy. able read file contentby c#, if file directly inside zip folder due inner directory structure become inaccessible.

any appreciated. in advance.

not sure how reading zip file contents without example, reading zip file contents using system.io.compression , system.io.compression.filesystem assemblies pretty simplistic. see following example of how read files regardless of subdirectory within zip file:

using system; using system.io.compression;  namespace zipreader {     class program     {         const string zippath = @"d:\test\test.zip";          static void main(string[] args)         {             using (var archive = zipfile.openread(zippath))             {                 foreach (var entry in archive.entries)                 {                     console.writeline(entry.fullname);                 }             }              console.readkey();         }     } } 

produces following output:

folder1/test1.txt folder2/test2.txt 

to contents can call entry.open() on each file returns stream can handle need to.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -