List of utility methods to do Directory to File List
List | getAllFiles(String dir) get All Files return getAllFiles(new File(dir)); |
List | getAllFiles(String dir, String extension) find files final List<File> ret = new ArrayList<File>(); final File file = new File(dir); if (file.exists()) { final String[] list = file.list(); for (int i = 0; i < list.length; i++) { final String fileName = dir + "/" + list[i]; final File f2 = new File(fileName); if (false == f2.isHidden()) { ... |
String[] | getAllFiles(String dir, String filePattern) get All Files File fd = new File(dir); if (!fd.exists() || !fd.isDirectory()) { return new String[0]; String rPattern = createRegexFromGlob(filePattern); return fd.list(new FilenameFilter() { @Override public boolean accept(File d, String fileName) { ... |
String[] | getAllFiles(String directory) Get all file (non-recursively) from a directory. File dir = new File(directory); String[] fns = dir.list(); return fns; |
List | getAllFiles(String directory) Recursively traverses the directory looking for all files. List<String> resultList = new ArrayList<>(); getAllFiles(new File(directory), resultList); return resultList; |
List | getAllFiles(String dirPath) Get list of files path under the directory recursively List<String> files = new ArrayList<>(); File folder = new File(dirPath); File[] listOfFiles = folder.listFiles(); for (int i = 0; i < listOfFiles.length; i++) { File file = listOfFiles[i]; String filePath = file.getPath(); if (file.isFile()) { if (!file.isHidden() && !file.getName().startsWith("_")) ... |
List | getAllFiles(String folderPath) get All Files List<File> list = new ArrayList<File>(); File file = getFile(folderPath); if (file.exists() && file.isDirectory()) { File filesTemp[] = file.listFiles(); for (int i = 0; i < filesTemp.length; i++) { list.add(filesTemp[i]); return list; |
List | getAllFiles(String path) get all files in a folder List<File> fileList = new ArrayList<File>(); File file = new File(path); if (!file.exists()) { return fileList; if (!file.isDirectory()) { return fileList; String[] tempList = file.list(); File tempFile; for (String fileName : tempList) { if (path.endsWith(File.separator)) { tempFile = new File(path + fileName); } else { tempFile = new File(path + File.separator + fileName); if (tempFile.isFile()) { fileList.add(tempFile); if (tempFile.isDirectory()) { List<File> allFiles = getAllFiles(tempFile.getAbsolutePath()); fileList.addAll(allFiles); return fileList; |
List | getAllFiles(String path, boolean isDepth) get all files in a folder (Only file) List<File> fileList = new ArrayList<>(); File file = new File(path); File[] tempList = file.listFiles(); if (tempList == null || !file.exists() || !file.isDirectory()) { return fileList; for (File tempFile : tempList) { if (isDepth) { ... |
String[] | getAllFiles(String sDirectoryPath) Returns the set of all files in the given directory
if (sDirectoryPath == null) { return new String[0]; File fileThisDirectory = new File(sDirectoryPath); if (fileThisDirectory.isDirectory() == false) { return new String[0]; } else { String[] asFileList = fileThisDirectory.list(); ... |