C#文件压缩

2022-10-22

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

《C#文件压缩.doc》

下载本文的Word格式文档,以方便收藏与打印。