I want to be able to be able to read files in zip files just as I would read files in a physical folder. How can I do this without having to extract the files?
Note that the produced zip will contain the directory structure as well as the files. As peterph points out in his comment, this is usually seen as a good thing: extracting the zip will neatly store all the extracted files in one subdirectory.
To unzip a single file or folder, open the zipped folder, then drag the file or folder from the zipped folder to a new location. To unzip all the contents of the zipped folder, press and hold (or right-click) the folder, select Extract All, and then follow the instructions.
Windows treats zip files just like folders. You can open a zip file, move files in and out of it, and open individual files just like you would if they were in a folder. Double-click the zip file.
There are some components out there that allow you to view the contents of a .zip file from your .NET application:
I've used the #ziplib before and it worked fine for my purposes which weren't too extensive.
I recently opened sourced my Platform.VirtualFileSystem C# library.
https://github.com/platformdotnet/Platform.VirtualFileSystem https://github.com/platformdotnet/Platform.VirtualFileSystem/wiki
You can read zip files like this:
var directory = FileSystemManager.Default.ResolveDirectory("zip://[file:///c:/test.zip]/");
directory.GetFiles().ForEach(Console.WriteLine);
It's available from NuGet: http://nuget.org/packages/Platform.VirtualFileSystem.Providers.Zip/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With