Lo-Fi unzipping functionality for .net

I’ve looked for unzipping functionality for .net a couple of times over the years and never found a totally satifactory solution.

In a recent project I had to grab an attachment from a POP box and then unzip the attachment.

I found an unzipping product called 7zip, it’s open source and there’s a command line version. See their downloads page for the commandline version – http://www.7-zip.org/download.html

Once you have this exe on your server you can easily unzip a file using the following code:

dim pathToZip as string = "c:\some\folder\file.zip"
Dim p As Process = Process.Start("C:\Program Files\7Zip\7za.exe", "e " & pathToZip & " -oc:\")
p.WaitForExit()

Obviously you are not limited to just unzipping, you can do anything the command line version does: zip, password protect a zip file, list the contents, etc

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.