Here you can find the source of getPaths(Path dir, String fileNames)
public static List<Path> getPaths(Path dir, String fileNames) throws IOException
//package com.java2s; // it under the terms of the GNU Lesser General Public License as published by import java.io.IOException; import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.List; public class Main { public static List<Path> getPaths(Path dir, String fileNames) throws IOException { List<Path> paths = new ArrayList<>(); DirectoryStream<Path> directories = Files.newDirectoryStream(dir); for (Path path : directories) { if (!Files.isDirectory(path)) { continue; }//from w w w.ja va2 s . c o m Path file = path.resolve(fileNames); if (!Files.exists(file)) { continue; } paths.add(file); } directories.close(); return paths; } }