Here you can find the source of recursiveDelete(Path pathToBeDeleted)
public static void recursiveDelete(Path pathToBeDeleted) throws IOException
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.Comparator; public class Main { public static void recursiveDelete(Path pathToBeDeleted) throws IOException { Files.walk(pathToBeDeleted).sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete); }/*from w w w . ja v a2s .c om*/ }