讀取特定資料夾下的xls檔
String docPath = String.format("%s/docs", System.getProperty("user.dir")); List<Path> xlsPaths = new ArrayList<>(); try (Stream<Path> paths = Files.walk(Paths.get(docPath))) { paths.filter(Files::isRegularFile) .filter(p -> p.toString().endsWith(".xls")) .forEach(xlsPaths::add); } xlsPaths.forEach(xls -> System.out.println(xls.toString()));
https://stackoverflow.com/questions/1844688/how-to-read-all-files-in-a-folder-from-java