I82*_*uch 26
File directory = new File("/path/to/folder");
File[] contents = directory.listFiles();
// the directory file is not really a directory..
if (contents == null) {
}
// Folder is empty
else if (contents.length == 0) {
}
// Folder contains files
else {
}
Run Code Online (Sandbox Code Playgroud)
if (file.isDirectory()) {
String[] files = file.list();
if (files.length == 0) {
//directory is empty
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13177 次 |
| 最近记录: |