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){}