Here you can find the source of recursivelyDelete(File aDirectory)
Parameter | Description |
---|---|
aDirectory | a parameter |
public static void recursivelyDelete(File aDirectory)
//package com.java2s; import java.io.*; public class Main { /**//from ww w. ja v a 2 s .c o m * Recursively deletes the given directory and all of * its nested contents. Use carefully! * * @param aDirectory */ public static void recursivelyDelete(File aDirectory) { if (!aDirectory.isDirectory()) { return; } File[] files = aDirectory.listFiles(); if (files != null) { for (File file : files) { if (file.isFile()) { file.delete(); } else { recursivelyDelete(file); } } } aDirectory.delete(); } }