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
130 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Expert Comment

by:sunilgohel
ID: 41779231
please try below code to unzip file

expand MyFile.zip myFile

Open in new window

0
 
LVL 6

Expert Comment

by:pritaeas
ID: 41779653
I've found an article that might help.
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 41779724
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

Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

726 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