public static void 递归删除(File file){
if (!file.exists()) {
System.out.println("delete file no exists " + file.getAbsolutePath());
return;
}
if (file.isFile()) {
file.delete();
} else if (file.isDirectory()) {
File files[] = file.listFiles();
for (int i = 0; i < files.length; i++) {
递归删除(files[i]);
}
}
file.delete();
}
java递归删除
最新推荐文章于 2024-04-13 10:46:41 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)