package com.landtool.lanbase.modules.api.utils; import java.io.File; /** * @Description: 删除文件 * @author ykm * @param * @return * @date 2018/4/19 16:42 */ public class DeleteFileUtils { public static boolean deletefile(String filePath) { File file = new File(filePath); if(file.exists() && file.isFile()) { if(file.delete()) { System.out.println("删除文件成功"); return true; } else { System.out.println("删除文件失败"); return false; } } else { System.out.println(filePath + "此路径不存在文件"); return false; } } public static boolean deleteDiretory(String dirPath) { if(!dirPath.endsWith(File.separator)) { dirPath = dirPath + File.separator; File file = new File(dirPath); boolean flag = false; if(file.exists() && file.isDirectory()) { File[] files = file.listFiles(); for (int i=0;i