• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 197
  • Last Modified:

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

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
zimmer9
Asked:
zimmer9
1 Solution
 
sunilgohelCommented:
please try below code to unzip file

expand MyFile.zip myFile

Open in new window

0
 
pritaeasSoftware EngineerCommented:
I've found an article that might help.
0
 
Éric MoreauSenior .Net ConsultantCommented:
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now