Java
Recursive 파일 정보 가져오기
바리새인
2024. 11. 6. 23:31
public class FileUtils {
public static List<Path> getFiles(String directory) {
try(Stream<Path> filePaths = Files.walk(Paths.get(directory))) {
return filePaths
.filter(Files::isRegularFile)
.collect(Collectors.toList());
} catch(IOException e) {
e.printStackTrace();
return List.of();
}
}
}