@GetMapping
public ResponseEntity<List<String>> fileTree(@RequestParam String path) {
File file = new File(BASE_PATH + path);
// check if file exists etc
return ResponseEntity.ok(Arrays.stream(file.listFiles())
.map(File::getName)
.collect(Collectors.toList()));
}
Something like that should work, basically you can get the files inside another file with File#listFiles
and then do with them wathever you want.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.