Java tutorial
import java.io.File; import java.nio.file.Paths; import java.util.stream.Stream; public class Main { public static void main(String[] args) { final String dir = "C:\\data\\projects\\"; final String pattern = ".pdf"; final File file = Paths.get(dir).toFile(); Stream.of(file.list((pFile, pString) -> pString.endsWith(pattern))).forEach(System.out::println); ; } }