c#如何压缩文件夹,生成一个压缩文件存放到某个路径下。
注意啊,不是网站上用户点击下载的时候压缩。
万分感谢。

解决方案 »

  1.   

    用Process调用压缩软件命令行。
      

  2.   

    System.IO.Compression.GZipStream 用这个东西。再外加一些自己的代码即可。
      

  3.   

    ICSharpCode.SharpZipLib.Zip.FastZip   zip   =   new   ICSharpCode.SharpZipLib.Zip.FastZip(); 
    zip.CreateEmptyDirectories=true; 
    zip.CreateZip(@ "c:\a.zip ",   @ "C:\temp ", true,null); 
    或调用winrar
    System.Diagnostics.Process Process1 = new System.Diagnostics.Process();
      Process1.StartInfo.FileName = "Winrar.exe";
      Process1.StartInfo.CreateNoWindow = true;
      Process1.StartInfo.Arguments = " a -r "+strzipPath+" " + strtxtPath ;
      Process1.StartInfo.Arguments = " a -ep " + strzipPath + " " + strtxtPath;
        
      

  4.   

    http://www.cnblogs.com/singlepine/archive/2006/01/06/312475.html
      

  5.   

    我想直接调用Winrar.exe,最下面两行是什么意思 能帮我解释一下吗
    我想压缩一个文件夹生成一个.rar文件,下面的代码要做什么修改。
    很着急,谢谢了。System.Diagnostics.Process Process1 = new System.Diagnostics.Process();
      Process1.StartInfo.FileName = "Winrar.exe";
      Process1.StartInfo.CreateNoWindow = true;
      Process1.StartInfo.Arguments = " a -r "+strzipPath+" " + strtxtPath ;
      Process1.StartInfo.Arguments = " a -ep " + strzipPath + " " + strtxtPath;