Here you can find the source of deleteRecursively(File fileOrDir)
public static void deleteRecursively(File fileOrDir)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.nio.file.Files; public class Main { public static void deleteRecursively(File fileOrDir) { if (fileOrDir.isDirectory() && !Files.isSymbolicLink(fileOrDir.toPath())) for (File f : fileOrDir.listFiles()) deleteRecursively(f);//from w w w. j a v a 2 s. co m fileOrDir.delete(); } }