public static bool ZipExtractFile(string zipFilePath,string targetPath)
        {
            FastZip fastZip = new FastZip();
            try
            {
                if (!Directory.Exists(targetPath))
                    Directory.CreateDirectory(targetPath);

                DirectoryInfo DirInfo = new DirectoryInfo(targetPath);
                       DirInfo.Attributes = FileAttributes.Normal & FileAttributes.Directory;



                fastZip.ExtractZip(zipFilePath, targetPath, "xls");
                return true;
            }
            catch
            {
                return false;
            }

        }

 

//这个方法不支持解压rar格式的文件,因为rar格式的文件是商业公司定义的,正版的winrar的软件也是收费的. 
用此方法解压rar格式的文件,会提示错误:"cann't find central directory"
//大家在使用的时候,请注意这一点 如下图所示:
 

使用ICSharpCode.SharpZipLib.Zip类库解压zip文件的方法

相关文章:

  • 2022-12-23
  • 2021-06-23
  • 2022-12-23
  • 2021-11-10
  • 2022-12-23
  • 2022-12-23
  • 2022-01-20
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-25
  • 2022-12-23
  • 2021-12-25
  • 2021-09-22
相关资源
相似解决方案