String path = System.getProperty("catalina.home")+"/temp";
File f = new File(path);
FileUtil.delete(f);
/**
* 删除目录或文件
* @param target 要删除的目录或文件
* @return 删除操作的结果 */
public static boolean delete(File target) {
boolean result = false;
if ((target != null) && (target.exists())) {
if (target.isFile()) {
result = target.delete();
} else if (target.isDirectory()) {
File[] files = target.listFiles();
for (int i=0; i<files.length &&delete(files[i]); i++) {
delete(files[i]);
}
return result;
}
}
return result;
}