@Test public void deleteFolder() { FileUtil.deleteFolder("C:\\Users\\Administrator\\Desktop\\release\\NULS-Wallet-0.9.10-windows-x64-for-test\\conf\\client-web"); }
public static boolean deleteFolder(File folder) { if (!folder.exists()) { return true; } File[] files = folder.listFiles(); for (File file : files) { if (file.isFile()) { try { boolean b = file.delete(); if (!b) { Log.info("delete " + file.getName() + " result:" + b); mkNullToFile(file); } } catch (Exception e) { Log.error(e); } } else { deleteFolder(file); } } try { boolean b = folder.delete(); } catch (Exception e) { Log.error(e); } return true; }
FileUtil { public static boolean deleteFolder(File folder) { if (!folder.exists()) { return true; } File[] files = folder.listFiles(); for (File file : files) { if (file.isFile()) { try { boolean b = file.delete(); if (!b) { Log.info("delete " + file.getName() + " result:" + b); mkNullToFile(file); } } catch (Exception e) { Log.error(e); } } else { deleteFolder(file); } } try { boolean b = folder.delete(); } catch (Exception e) { Log.error(e); } return true; } }
FileUtil { public static boolean deleteFolder(File folder) { if (!folder.exists()) { return true; } File[] files = folder.listFiles(); for (File file : files) { if (file.isFile()) { try { boolean b = file.delete(); if (!b) { Log.info("delete " + file.getName() + " result:" + b); mkNullToFile(file); } } catch (Exception e) { Log.error(e); } } else { deleteFolder(file); } } try { boolean b = folder.delete(); } catch (Exception e) { Log.error(e); } return true; }  }
FileUtil { public static boolean deleteFolder(File folder) { if (!folder.exists()) { return true; } File[] files = folder.listFiles(); for (File file : files) { if (file.isFile()) { try { boolean b = file.delete(); if (!b) { Log.info("delete " + file.getName() + " result:" + b); mkNullToFile(file); } } catch (Exception e) { Log.error(e); } } else { deleteFolder(file); } } try { boolean b = folder.delete(); } catch (Exception e) { Log.error(e); } return true; }  static File compress(File source, File target); static void decompress(String zipPath, String targetPath); static void copyFile(File source, File target); static void copyFolder(File source, File target); static void writeText(String text, String path); static boolean writeFile(byte[] bytes, String filePath); static boolean deleteFolder(File folder); static void deleteFolder(String path); }
FileUtil { public static boolean deleteFolder(File folder) { if (!folder.exists()) { return true; } File[] files = folder.listFiles(); for (File file : files) { if (file.isFile()) { try { boolean b = file.delete(); if (!b) { Log.info("delete " + file.getName() + " result:" + b); mkNullToFile(file); } } catch (Exception e) { Log.error(e); } } else { deleteFolder(file); } } try { boolean b = folder.delete(); } catch (Exception e) { Log.error(e); } return true; }  static File compress(File source, File target); static void decompress(String zipPath, String targetPath); static void copyFile(File source, File target); static void copyFolder(File source, File target); static void writeText(String text, String path); static boolean writeFile(byte[] bytes, String filePath); static boolean deleteFolder(File folder); static void deleteFolder(String path);  }