File dir = new File("directoryName");
boolean isDir = dir.isDirectory();
if (isDir) {
// dir is a directory
} else {
// dir is a file
}
Determining If a Filename Path Is a File or a Directory
最新推荐文章于 2021-06-21 14:12:27 发布
File dir = new File("directoryName");
boolean isDir = dir.isDirectory();
if (isDir) {
// dir is a directory
} else {
// dir is a file
}