测试代码
public static void main(String[] args) {
//删除测试文件夹及文件夹下的文件
String filePath = "E:\\测试文件夹\\";
deleteFile(filePath);
}
public static void deleteFile(String filePath){
File file = new File(filePath);
File[] files = file.listFiles();
if (files != null && files.length > 0){
for (File file1 : files){
deleteFile(file1.getAbsolutePath());
}
}
file.delete();
}
667





