Java Delete Directory Recursively deleteDirRecursive(File aDir)

Here you can find the source of deleteDirRecursive(File aDir)

Description

delete Dir Recursive

License

Open Source License

Declaration

public static void deleteDirRecursive(File aDir) 

Method Source Code

//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();
    }
}

Related

  1. deleteDirectoryRecursive(File f)
  2. deleteDirectoryRecursively(File rootFile)
  3. deleteDirectoryRecursively(File toDelete)
  4. deleteDirectoryRecursivelyE(File dir)
  5. deleteDirectoryRecursivly(File directory)
  6. deleteDirRecursively(File dir)
  7. deleteDirRecursively(File directory)