package ink.wgink.util; import java.io.File; /** * @ClassName: FolderUtil * @Description: 文件夹工具 * @Author: WangGeng * @Date: 2019-05-28 13:46 * @Version: 1.0 **/ public class FolderUtil { /** * 创建文件夹 * * @param folderPath */ public static void createFolder(String folderPath) { File folder = new File(folderPath); if (folder.exists()) { return; } folder.mkdirs(); } /** * 删除文件 * * @param path */ public static void delete(String path) { File file = new File(path); if (!file.exists()) { return; } if (file.isFile()) { file.delete(); return; } File[] subFiles = file.listFiles(); if (subFiles != null) { for (File subFile : subFiles) { delete(subFile.getAbsolutePath()); } } file.delete(); } }