List of utility methods to do Folder Read Recursive
List | getFiles(File dir, String excludeFiles, boolean includeFiles, boolean includeDirs, boolean recursive, List Recursive function to descend into the directory tree and find all the files and directories excluding those specified by exclude. File listFile[] = dir.listFiles(); if (listFile != null) { for (int i = 0; i < listFile.length; i++) { if (!excludeFile(listFile[i].getName(), excludeFiles)) { if (listFile[i].isDirectory()) { if (includeDirs) { filelist.add(listFile[i]); if (recursive) { filelist = getFiles(listFile[i], excludeFiles, includeFiles, includeDirs, recursive, filelist); } else { if (includeFiles) filelist.add(listFile[i]); return filelist; |
List | getFiles(File directory, boolean recursive) Get all files in a directory List<File> fileList = new ArrayList<File>(); if (!directory.isDirectory()) { fileList.add(directory); return fileList; File[] files = directory.listFiles(); for (File f : files) { if (f.isDirectory()) { ... |
List | getFiles(File directory, boolean recursive) get Files if (!directory.isDirectory()) { throw new AssertionError(directory + " is not a directory!"); List<File> files = new ArrayList<>(); for (File f : directory.listFiles()) { if (f.isDirectory() && recursive) { files.addAll(getFiles(f, recursive)); } else { ... |
ArrayList | getFilesAsArrayListRecursive(String path) get Files As Array List Recursive ArrayList<String> mFileList = new ArrayList<String>(); File root = new File(path); getFilesAsArrayListRecursiveHelper(root, mFileList); return mFileList; |
void | getFilesAsArrayListRecursiveHelper(File f, ArrayList get Files As Array List Recursive Helper if (f.isDirectory()) { File[] childs = f.listFiles(); for (File child : childs) { getFilesAsArrayListRecursiveHelper(child, filelist); return; filelist.add(f.getAbsolutePath()); ... |
void | getFilesByNameRecursive(Collection Get all files existing in the path with the specified name. for (final File file : path.listFiles()) { if (file.isFile() && file.getName().equals(name)) { filesList.add(file); } else if (file.isDirectory()) { getFilesByNameRecursive(filesList, file, name); |
List | getFilesForFolder(File folder, boolean recursive) Returns a sorted list of files contained in the directory. List<File> fileList = new ArrayList<File>(); listFilesForFolder(fileList, folder, recursive); Collections.sort(fileList); return fileList; |
File[] | getFilesParent(File dir, String excludeFiles, boolean includeParentDir, boolean includeFiles, boolean includeDirs, boolean recursive) This is the initial parent to getFiles. File[] files = null; List<File> filelist = new ArrayList<File>(); filelist = getFiles(dir, excludeFiles, includeFiles, includeDirs, recursive, filelist); if (includeParentDir) { files = new File[filelist.size() + 1]; files[0] = dir; for (int i = 0; i < filelist.size(); i++) { files[i + 1] = filelist.get(i); ... |