原文链接:https://blog.csdn.net/jk007/article/details/30251963
using ICSharpCode.SharpZipLib.Zip;
public static void CompressDirectory(string iDirectory, string oFile)
{
FastZip fastzip = new FastZip();
Create Empty Directory
fastzip.CreateEmptyDirectories = true;
fastzip.CreateZip(oFile, iDirectory, true, string.Empty);
}
public static void DecompressDirectory(string iFile, string oDirectory)
{
FastZip fastzip = new FastZip();
Create Empty Directory
fastzip.CreateEmptyDirectories = true;
fastzip.ExtractZip(iFile, oDirectory, string.Empty);
}
相关知识:
ZipFile类用于选择文件或文件夹进行压缩生成压缩包。
FastZip用于快速压缩目录,有一个方法CreateZip.
参数说明:
zipFileName:生成的压缩文件
sourceDirectory:待压缩的文件夹
recurse:是否遍历子目录,True就遍历,False则不遍历
fileFilter:文件过滤,即决定那些后缀的文件被压缩
ZipOutputStream:相当于一个压缩包;
ZipEntry:相当于压缩包里的一个文件;
标签:解压,string,FastZip,文件夹,fastzip,SharpZipLib,Empty From: https://www.cnblogs.com/Dongmy/p/18118633