`

Filter out files from directory--Java

    博客分类:
  • Java
阅读更多

  private void process(String path, FileWriter fw) throws Exception {
    FilenameFilter filter = new FilenameFilter() {
      public boolean accept(File dir, String name) {
        return name.endsWith(".xml");
      }
    };

    File dir = new File(path);
    String[] children = dir.list(filter);

    for (int i = 0; i < children.length; i++) {
      // Get filename of file or directory
      String filename = children[i];
      System.out.println(filename);
      File file = new File(path + "\\" + filename);
      processFile(file, fw);
    }
  }

0
0
分享到:
评论

相关推荐

    UE(官方下载)

    Create a customized user tool to check out files from Visual SourceSafe Running WebFOCUS from UltraEdit Configure UltraEdit for use with WebFOCUS CSE HTML Validator CSE ...

    BSD HACKS -- 100个业界最尖端的技巧和工具

    Script IP Filter Rulesets Section 65. Secure a Wireless Network Using PF Section 66. Automatically Generate Firewall Rules Section 67. Automate Security Patches Section 68. Scan a ...

    jpivot学习总结.doc

    from Sales [Customers]"/&gt; [Products].[Category]" sessionParam="Category"/&gt; &lt;/jp:mondrianQuery&gt; 该标签的主要属性如下: 属性名 必须 数据类型 是否能动态计算指定 描述 urlPattern 否 String ...

    测试培训教材

    This allows you to build a more advanced test set execution flow, in which you can filter tests in a test set during execution, based on the status or type of each test. VAPI-XP is also fully ...

    ZendFramework中文文档

    1. Introduction to Zend Framework 1.1. 概述 1.2. 安装 2. Zend_Acl 2.1. 简介 2.1.1. 关于资源(Resource) 2.1.2. 关于角色(Role) 2.1.3. 创建访问控制列表(ACL) ...14.5.5. Adding Filter ...

    华为编程开发规范与案例

    在新的编程思想中,指针基本上被禁止使用(JAVA中就是这样),至少也是被限制使用。而在我们交换机的程序中大量使用指针,并且有增无减。 2、防止指针/数组操作越界 【案例1.2.1】 在香港项目测试中,发现ISDN话机...

Global site tag (gtag.js) - Google Analytics