C#文件压缩
程序员文章站
2022-07-06 10:19:03
using System.IO.Compression; string TOZipPath = String.Format("~/Static/ZIP/{0}", DirName); //需要压缩的源文件 string TOZipFilePath = String.Format("~/Static/ ......
using system.io.compression;
string tozippath = string.format("~/static/zip/{0}", dirname); //需要压缩的源文件
string tozipfilepath = string.format("~/static/zip/{0}", dirname + ".zip"); //压缩成新的zip文件
try
{
zipfile.createfromdirectory(server.mappath(tozippath), server.mappath(tozipfilepath));
}
catch (exception ex){}