List of utility methods to do Folder Read by Filter
List | getFiles(File dir, FilenameFilter filter) get Files List<File> result = new ArrayList<File>(); getFiles(dir, result, filter); return result; |
List | getFiles(File folder, FilenameFilter filter) get Files return getFiles(folder, filter, true);
|
List | getFiles(File root, boolean recurse, FileFilter fileFilter) get Files List<File> result = new LinkedList<File>(); if (root.isDirectory()) { for (File file : root.listFiles()) { if (file.isDirectory() && recurse) { result.addAll(getFiles(file, recurse, fileFilter)); } else if (file.isFile() && fileFilter.accept(file)) { result.add(file); } else { result.add(root); return result; |
List | getFiles(final File directory, final FilenameFilter filter) get Files if (directory.isDirectory()) { final File[] files = directory.listFiles(filter); if (files == null) { return Collections.emptyList(); } else { return Arrays.asList(files); } else { ... |
List | getFiles(String name, FileFilter filter, boolean includeSubtree) Returns a list of all filtered files in the RFS. If the Despite the filter may not accept folders, every subfolder is traversed if the
List<File> ret = new ArrayList<File>(); File file = new File(name); if (!file.isDirectory()) { file = new File(file.getParent()); if (!file.isDirectory()) { return ret; File[] dirContent = file.listFiles(); for (int i = 0; i < dirContent.length; i++) { File f = dirContent[i]; if (filter.accept(f)) { ret.add(f); if (includeSubtree && f.isDirectory()) { ret.addAll(getFiles(f.getAbsolutePath(), filter, true)); return ret; |
List | getFiles(String sourceDirPath, FilenameFilter filter, Comparator get Files File file = new File(sourceDirPath); if (!file.exists()) { throw new IOException("Directory " + sourceDirPath + " does not exist"); if (!file.isDirectory()) { throw new IOException("File " + sourceDirPath + " is not a directory"); String[] files = file.list(filter); ... |
ArrayList | getFiles(String sourceName, FilenameFilter filter) Get the list of files contained in parent parameter directory File sourceFile = new File(sourceName); ArrayList result = new ArrayList(); if (!sourceFile.exists() || !sourceFile.isDirectory()) return result; String[] fileNames = sourceFile.list(filter); if (fileNames == null) return result; for (int i = 0; i < fileNames.length; i++) { ... |
FileFilter | getFilesOnlyFilter() get Files Only Filter return filesOnlyFilter;
|
List | getFilesRealWorking(File aStartingDir, FilenameFilter filter) get Files Real Working List<File> result = new ArrayList<File>(); File[] filesAndDirs = aStartingDir.listFiles(); List filesDirs = Arrays.asList(filesAndDirs); Iterator filesIter = filesDirs.iterator(); File file = null; while (filesIter.hasNext()) { file = (File) filesIter.next(); if (filter.accept(aStartingDir, file.getName())) { ... |
List | getFilesUnder(String path, FileFilter fileFilter) get Files Under File root = new File(path); List<File> files = new ArrayList<File>(); addFilesUnder(root, files, fileFilter); return files; |