📜  java 删除目录 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:26.501000             🧑  作者: Mango

代码示例1
boolean deleteDirectory(File directoryToBeDeleted) {
    File[] allContents = directoryToBeDeleted.listFiles();
    if (allContents != null) {
        for (File file : allContents) {
            deleteDirectory(file);
        }
    }
    return directoryToBeDeleted.delete();
}