public class Dome03 {
public static void main(String[] args) {
File src = new File(“要删除文件的路径”);
deleteDir(src);
}
private static void deleteDir(File src) {
File[] files = src.listFiles();
for (File file : files) {
if (file.isFile()){
file.delete();
}else {
deleteDir(file);
}
}
src.delete();
}
}