Sunday, April 9, 2017

C# code snippet for creating, extracting a compressed zip file

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
using System;
using System.IO;
using System.IO.Compression;
     
           string filePath = @"c:\temp\EmployeeInfo";
            string zipPath = @"c:\temp\EmployeeInfo.zip";
            string extractPath = @"c:\temp\extract";

            ZipFile.CreateFromDirectory(startPath, zipPath);

            ZipFile.ExtractToDirectory(zipPath, extractPath);