Here you can find the source of deleteDirRecursively(File dir)
Parameter | Description |
---|---|
dir | a parameter |
public static boolean deleteDirRecursively(File dir)
//package com.java2s; import java.io.*; public class Main { /**//from w ww.j a v a 2s.c om * Given a filepath, delete all files in the directory recursively * @param dir * @return {@code true} if the deletion is successful, {@code false} otherwise */ public static boolean deleteDirRecursively(File dir) { if (dir.isDirectory()) { for (File f : dir.listFiles()) { boolean success = deleteDirRecursively(f); if (!success) return false; } } return dir.delete(); } }