📅  最后修改于: 2022-03-11 14:52:08.314000             🧑  作者: Mango
List results = new ArrayList();
File[] files = new File("/path/to/the/directory").listFiles();
//If this pathname does not denote a directory, then listFiles() returns null.
for (File file : files) {
if (file.isFile()) {
results.add(file.getName());
}
}