标签:try ast equal i++ dep 目录 last als int
public static List<String> listFile(List<String> lstFileNames, File f, String suffix, boolean isdepth) { // 若是目录, 采用递归的方法遍历子目录 try { if (f.isDirectory()) { File[] t = f.listFiles(); for (int i = 0; i < t.length; i++) { if (isdepth || t[i].isFile()) { listFile(lstFileNames, t[i], suffix, isdepth); } } } else { String filePath = f.getPath(); if (!suffix.equals("")) { int begIndex = filePath.lastIndexOf("."); String tempsuffix = ""; if (begIndex != -1) { tempsuffix = filePath.substring(begIndex + 1, filePath.length()); if (suffix.contains("." + tempsuffix + ".")) { System.out.println("filePath:"+filePath); lstFileNames.add(filePath); } } } else { lstFileNames.add(filePath); } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return lstFileNames; }
标签:try ast equal i++ dep 目录 last als int
原文地址:http://www.cnblogs.com/yangqimo/p/7488567.html