Link to home
Start Free TrialLog in
Avatar of zimmer9
zimmer9Flag for United States of America

asked on

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);
Avatar of sunilgohel
sunilgohel

please try below code to unzip file

expand MyFile.zip myFile

Open in new window

I've found an article that might help.
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial