List of utility methods to do Directory to File List
void | getAllFilesRecursively(File directory, Collection Helper for getAllSubdirectories(directory). for (File file : directory.listFiles()) { if (file.isDirectory()) { getAllFilesRecursively(file, files); } else { files.add(file); |
File[] | getAllFilesWithExtension(String directory, final String extension) get All Files With Extension return getAllFilesWithExtension(new File(directory), extension); |
Iterable | getAllFilesWithExtension(String folderPath, String extension) get All Files With Extension File folder = new File(folderPath); File[] files = folder.listFiles(); if (files == null) { return new ArrayList<>(); return Arrays.asList(files).stream() .filter(file -> file.isFile() && file.getName().toLowerCase().endsWith(extension.toLowerCase())) .collect(Collectors.toList()); ... |
String[] | getAllFilesWithFilter(String DirectoryName, FilenameFilter Filter) { method File TestFile = new File(DirectoryName); return (getAllFilesWithFilter(TestFile, Filter)); |