zoukankan      html  css  js  c++  java
  • 查找文件目录下及子目录下所有文件

    /**
         * 获取某个文件夹及子文件下的所有后缀的列表
         *@auther zhangcd
         *@date 2016年12月26日
         *@param dirStr
         *@param suffixFilter
         *@return
         *@throws IOException
         */
        public static List<File> getFolderList(File dir, String suffixFilter) throws IOException {
            List<File> result = new ArrayList<File>();
            File[] lists = dir.listFiles();
            for (File file : lists) {
                if(file.isDirectory()){
                    List<File> childs = getFolderList(file,suffixFilter);
                    if(childs != null){
                        result.addAll(childs);
                    }
                }else if(file.getName().endsWith(suffixFilter)){
                    result.add(file);
                }
            }
            return result;
        }
  • 相关阅读:
    公司真题-字节跳动
    全素组探求
    枚举
    求n个整数的最大公约数
    Ajax技术
    读文本文件
    JSTL标签库
    URL跟URi的区别
    常用的JSTL标签
    EL表达语言
  • 原文地址:https://www.cnblogs.com/lingbing/p/6236652.html
Copyright © 2011-2022 走看看