void Main() { var zipPath = ReadLine("Insert the zip file path:"); new ZipUtility().UnzipFile(zipPath); } public static string ReadLine(string message) { Console.WriteLine(message); return Console.ReadLine(); } public class ZipUtility { public void UnzipFile(string zipPath) { var fileInfo = new FileInfo(zipPath); var extractPath = Path .Combine( fileInfo.DirectoryName, Path.GetFileNameWithoutExtension(zipPath)); if (Directory.Exists(extractPath)) { Directory.Delete(extractPath, true); } Directory.CreateDirectory(extractPath); UnzipFile(zipPath, extractPath); } public void UnzipFile(string zipPath, string extractPath) { var shell = (dynamic)GetShell(); dynamic scrFolder = shell.Namespace(zipPath); dynamic destFolder = shell.NameSpace(extractPath); dynamic items = scrFolder.Items(); destFolder.CopyHere(items, 20); } public void ZipFile(string zipPath, string folderPathToCompress) { var shell = (dynamic)GetShell(); dynamic scrFolder = shell.Namespace(folderPathToCompress); dynamic destFolder = shell.NameSpace(zipPath); dynamic items = scrFolder.Items(); destFolder.CopyHere(items, 4); } private object GetShell() { var shellType = Type.GetTypeFromProgID("Shell.Application"); return Activator.CreateInstance(shellType); } }