Java Recursive Delete recursiveDelete(final File pFile)

Here you can find the source of recursiveDelete(final File pFile)

Description

Deleting a storage recursive.

License

Open Source License

Parameter

Parameter Description
pFile which should be deleted included descendants

Return

true if delete is valid

Declaration

public static boolean recursiveDelete(final File pFile) 

Method Source Code


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

import java.io.File;

public class Main {
    /**//from  www . j  a  v a 2  s .c o  m
     * Deleting a storage recursive. Used for deleting a databases
     * 
     * @param pFile
     *            which should be deleted included descendants
     * @return true if delete is valid
     */
    public static boolean recursiveDelete(final File pFile) {
        if (pFile.isDirectory()) {
            for (final File child : pFile.listFiles()) {
                if (!recursiveDelete(child)) {
                    return false;
                }
            }
        }
        return pFile.delete();
    }
}

Related

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