java 删除文件夹及文件,dirPath是文件夹路径
public void deleteDir(String dirPath) {
File file = new File(dirPath);
if(file.isFile()) {
file.delete();
}else {
File[] files = file.listFiles();
if(files == null) {
file.delete();
}else {
for (int i = 0; i < files.length; i++) {
deleteDir(files[i].getAbsolutePath());
}
file.delete();
}
}
}
向大家推荐《Activiti工作流实战教程》:https://xiaozhuanlan.com/activiti