首先引入程序集:using Ionic.Zip;
直接使用
【例】打包一个文件夹
using (ZipFile zip = new ZipFile())
直接使用
【例】打包一个文件夹
using (ZipFile zip = new ZipFile())
{
zip.AddDirectory(folderPath); //folderPath文件夹的物理路径
zip.Comment = "This zip was created at " + System.DateTime.Now.ToString("G");
zip.Save(folderPath + ".rar"); //生成包的名称
}
}
浙公网安备 33010602011771号