Solved

Do you know how to write C# code to use Shell32 to unzip a file? I am using .Net Framework 4.0

Posted on 2016-08-31
3
44 Views
Last Modified: 2016-09-09
I am developing a C# application using VS2010 and .Net Framework 4.0

Do you know how to write C# code to use Shell32 to unzip a file ?

For ex:

let's assume I have a directory C:\TIFFILES   and in this directory,
I have a zipfile that of course has the file extension *.zip

and I want to unzip this file in this same folder C:\TIFFILES


------------

            const string TARGET_DIR_IN = @"\\C:\TIFFILES";
            string zipFilePath = Path.Combine(TARGET_DIR_IN, "???.zip");
                                             
            Shell32.Shell objShell = new Shell32.Shell();
            Shell32.Folder destinationFolder = objShell.NameSpace(TARGET_DIR_IN);
            Shell32.Folder sourceFile = objShell.NameSpace(zipFilePath);
0
Comment
Question by:zimmer9
3 Comments
 
LVL 1

Expert Comment

by:sunilgohel
Comment Utility
please try below code to unzip file

expand MyFile.zip myFile

Open in new window

0
 
LVL 6

Expert Comment

by:pritaeas
Comment Utility
I've found an article that might help.
0
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 500 total points
Comment Utility
instead of using shell, there are some built-in features in .Net: http://emoreau.com/Entries/Articles/2008/08/Introducing-SystemIOPackaging.aspx
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now