参考:https://blog.csdn.net/zhaotianff/article/details/141156035
using System.IO.Compression; namespace XCG.Commons { public class ZipUtil { /// <summary> /// 压缩zip /// </summary> /// <param name="inputFolder">要压缩的目录</param> /// <param name="destinationZipPath">压缩后zip存放地址</param> public static void CreateZip(string inputFolder, string destinationZipPath) { if (Directory.Exists(inputFolder)) { ZipFile.CreateFromDirectory(inputFolder, destinationZipPath); } } /// <summary> /// 解压zip /// </summary> /// <param name="zipFilePath">zip压缩包地址</param> /// <param name="extractPath">解压到此目录</param> public static void ExtractZip(string zipFilePath, string extractPath) { if (File.Exists(zipFilePath)) { ZipFile.ExtractToDirectory(zipFilePath, extractPath); } } } }
标签:解压,string,zip,压缩,NET,public From: https://www.cnblogs.com/xsj1989/p/18463495