春秋-從0到1-CTFer成長(zhǎng)之路
2023-08-26 13:58 作者:bili_67158895267 | 我要投稿
列出文件和目錄
File dir = new File("directoryName");
String[] children = dir.list();
if (children == null) {
? // Either dir does not exist or is not a directory
} else {
? for (int i=0; i < children.length; i++) {
? ? // Get filename of file or directory
? ? String filename = children[i];
? }
}
// It is also possible to filter the list of returned files.
// This example does not return any files that start with `.'.
FilenameFilter filter = new FilenameFilter() {
? public boolean accept(File dir, String name) {
? ? return !name.startsWith(".");
? }
};
標(biāo)簽: