Here you can find the source of deleteDirRecursive(File aDir)
public static void deleteDirRecursive(File aDir)
//package com.java2s; /* //from ww w . j a v a 2 s .c om * Copyright 2009 by the authors indicated in the @author tags. * All rights reserved. * * See the LICENSE file for details. * * Created by Guenter Bartsch on Mar 9, 2009 */ import java.io.File; public class Main { public static void deleteDirRecursive(File aDir) { if (!aDir.exists()) return; if (aDir.isDirectory()) { File[] files = aDir.listFiles(); for (int i = 0; i < files.length; i++) { deleteDirRecursive(files[i]); } } aDir.delete(); } }