Java Recursive Delete recursiveDelete(final File path, final boolean deleteParent)

Here you can find the source of recursiveDelete(final File path, final boolean deleteParent)

Description

recursive Delete

License

Open Source License

Declaration

public static void recursiveDelete(final File path, final boolean deleteParent) 

Method Source Code


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

import java.io.*;

public class Main {
    public static void recursiveDelete(final File path, final boolean deleteParent) {
        if (!path.exists()) {
            return;
        }/*  w ww.  j  a v  a  2s .c om*/
        for (final File file : path.listFiles()) {
            if (file.isDirectory()) {
                recursiveDelete(file, true);
            } else {
                file.delete();
            }
        }
        if (deleteParent) {
            path.delete();
        }
    }
}

Related

  1. recursiveDelete(File target)
  2. recursiveDelete(final File directory)
  3. recursiveDelete(final File file, final boolean childrenOnly)
  4. recursiveDelete(final File fileOrDir)
  5. recursiveDelete(final File path)
  6. recursiveDelete(final File pFile)
  7. recursiveDelete(final File root, final File file)
  8. recursiveDelete(String fileName)
  9. recursiveDelete(String p_path, boolean p_deletemetoo)