Java递归删除文件目录的方法


public
static void delDir(String path){ File dir=new File(path); if(dir.exists()){ File[] tmp=dir.listFiles(); for(int i=0; i<tmp.length; i++){ if(tmp[i].isDirectory()){ delDir(path+"/"+tmp[i].getName()); } else{ tmp[i].delete(); } } dir.delete(); } }

猜你喜欢

转载自www.cnblogs.com/shengulong/p/9920622.html
今日推荐