【java】删除文件
/** * 删除文件、文件夹 */ public static void deleteFile(String path) { File file = new File(path); if (file.isDirectory()) { File[] ff = file.listFiles(); for (int i = 0; i < ff.length; i++) { deleteFile(ff[i].getPath()); } } file.delete(); }
/** * 删除文件、文件夹 */ public static void deleteFile(String path) { File file = new File(path); if (file.isDirectory()) { File[] ff = file.listFiles(); for (int i = 0; i < ff.length; i++) { deleteFile(ff[i].getPath()); } } file.delete(); }