Java Recursive Delete recursiveDelete(File dir)

Here you can find the source of recursiveDelete(File dir)

Description

Recursive delete.

License

Open Source License

Parameter

Parameter Description
dir the dir

Declaration

private static void recursiveDelete(File dir) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

public class Main {
    /**/*from w  w w  . j a  v a2  s  .  c om*/
     * Recursive delete.
     * 
     * @param dir
     *            the dir
     */
    private static void recursiveDelete(File dir) {
        if (dir == null)
            return;
        if (dir.isFile()) {
            dir.delete();
            return;
        }
        File[] entries = dir.listFiles();
        if (entries == null) {
            return;
        }
        for (File entry : entries) {
            recursiveDelete(entry);
        }
        dir.delete();
    }
}

Related

  1. recursiveDel(final File f)
  2. recursiveDelete(File _f)
  3. recursiveDelete(File base)
  4. recursiveDelete(File dir)
  5. recursiveDelete(File dir)
  6. recursiveDelete(File dir, boolean deleteBase)
  7. recursiveDelete(File dirPath)