zoukankan      html  css  js  c++  java
  • SharpZipLib 文件/文件夹 过滤

    这里就不说压缩/解压了。网上教程太多。

    主要说一下,解压时,如何过滤某些文件/文件夹

    参考地址:https://github.com/icsharpcode/SharpZipLib/wiki/FastZip

    主要内容:

    解压时:过滤文件

    以下表达式包含所有以“.dat”结尾的名称,但“dummy.dat”除外

    // To conditionally extract files in FastZip, use the fileFilter and directoryFilter arguments.
        // The filter is a list of regex values separated with semi-colon. An entry starting with - is an exclusion.
        // See the NameFilter class for more details.
        // The following expression includes all name ending in '.dat' with the exception of 'dummy.dat'
        string fileFilter = @"+.dat$;-^dummy.dat$";
        string directoryFilter = null;
        bool restoreDateTime = true;
     
        // Will prompt to overwrite if target filenames already exist
        fastZip.ExtractZip(zipFileName, targetDir, FastZip.Overwrite.Prompt, OverwritePrompt,
                           fileFilter, directoryFilter, restoreDateTime);

    解压时:过滤文件夹

    以下是解压时,过滤Download和Upload文件夹

    (new FastZip()).ExtractZip(downloadFile, UnPath, FastZip.Overwrite.Always, null, "", @"-Download;-Update", true);
  • 相关阅读:
    开源交易所源码搜集
    域名
    国外大牛博客
    Fomo3D代码分析以及漏洞攻击演示
    Small组件化重构安卓项目
    html span和div的区别
    七牛云
    以太坊钱包安全性保证
    跨域问题
    checkout 到bit/master分支
  • 原文地址:https://www.cnblogs.com/hanjun0612/p/11722586.html
Copyright © 2011-2022 走看看