List of utility methods to do File List from Folder
HashSet | getFilesFromFolder(String folder, String mustHave, String doesntMustHave, boolean isPrevious) Gets the files from folder. HashSet<String> result = new HashSet<String>(); File dir = new File(folder); HashSet<String> files = new HashSet<String>(); findAllFiles(dir, files, mustHave, doesntMustHave, isPrevious); result.addAll(files); return result; |
void | getFilesFromFolder(String folderPath, ArrayList get Files From Folder File folder = new File(folderPath); File[] fList = folder.listFiles(); if (fList != null) { for (File file : fList) { if (file.isFile()) { files.add(file); } else if (file.isDirectory()) { getFilesFromFolder(file.getAbsolutePath(), files); ... |
List | getFilesFromFolder(String folderPath, boolean withAbsolPath) get Files From Folder File folder = new File(folderPath); List<String> toRet = new ArrayList<>(); String[] allFiles = folder.list(); if (withAbsolPath) { for (String file : allFiles) { toRet.add(folderPath + File.separator + file); } else ... |