public static boolean deleteFolder(String url) {
File file = new File(url);
if (!file.exists()) {
return false;
}
if (file.isFile()) {
file.delete();
return true;
} else {
File[] files = file.listFiles();
for (int i = 0; i < files.length; i++) {
String root = files[i].getAbsolutePath();//得到子文件或文件夹的绝对路径
//System.out.println(root);
deleteFolder(root);
}
file.delete();
return true;
}
}