/**
* 删除文件
* <p>
* Author renbin.fang, 2012-9-27
*
* @param file
* @return true or false
*/
private boolean deleteFile(File file) {
if (file.exists()) {
if (file.isFile()) {
file.delete();
}
else if (file.isDirectory()) {
File files[] = file.listFiles();
for (int i = 0; i < files.length; i++) {
this.deleteFile(files[i]);
}
}
file.delete();
}
else {
System.out.println(“所删除的文件不存在!” + ‘\n’);
return false;
}

return true;
}



Published

08 October 2012