package com.homework;
import java.io.File;
public class Topic7 {
public static void main(String[] args) {
File file = new File("F:\\studyspace\\demo");
delateFile(file);
}
public static void delateFile(File file){
if(!file.exists()){
return;
}
File[] files = file.listFiles();
if(files!=null){
System.out.println("feikong");
for (File f : files) {
if(f.isDirectory()){
delateFile(f);
}else{
f.delete();
}
}
}
file.delete();
}
}
|
|