2011-03-09 4 views
0
Can any one have the idea how to zip folders (including sub files and folders like winrar doing) using C#...? 
+0

중복 : [Zip 폴더 (C#)] (http://stackoverflow.com/questions/905654/zip-folder-in- 기음) –

답변

1

: 난 그냥 제공하는 웹 사이트 링크에서 붙여 http://dotnetzip.codeplex.com/

사용의 예, #ziplib (SharpZipLib, 이전 NZipLib)입니다 Zip, GZip, Tar 및 BZip2 라이브러리는 .NET 플랫폼 용으로 C#으로 작성되었습니다.)

2

이것은 zip 관련 작업과 파일을 처리하기위한 매우 유용한 일반 .NET 유틸리티입니다. 사이트에서 SharpZipLib (: :이 발견 빠른 구글 후

 

using (ZipFile zip = new ZipFile()) 
{ 
    // add this map file into the "images" directory in the zip archive 
    zip.AddFile("c:\\images\\personal\\7440-N49th.png", "images"); 
    // add the report into a different directory in the archive 
    zip.AddFile("c:\\Reports\\2008-Regional-Sales-Report.pdf", "files"); 
    zip.AddFile("ReadMe.txt"); 
    zip.Save("MyZipFile.zip"); 
}