递归删除文件目录
package IO.file.test; import java.io.File; public class RemoverDirTest { public static void main(String[] args) { File dir=new File("e:\\abc"); removeDir(dir); } public static void removeDir(File dir) { File[] files=dir.listFiles(); for(File file:files) { if(file.isDirectory()) { removeDir(file); } else System.out.println(file.delete()); } dir.delete(); } }