// Lists the files in the selected directories that match the predefined extensions. public static List<File> getFilesFromDisk(Path p) { List<File> result = new ArrayList<>(); try (DirectoryStream<Path> stream = Files.newDirectoryStream(p, "*.{wmv,mp4,flv,mov,avi,mkv}")) { for (Path entry : stream) { result.add(new File(entry.getFileName().toString(), Files.size(entry), null)); } } catch (IOException | DirectoryIteratorException ex) { ex.printStackTrace(); } return result; }