Java File Path Delete deleteDirectoryRecursively(File path)

Here you can find the source of deleteDirectoryRecursively(File path)

Description

delete Directory Recursively

License

Open Source License

Declaration

public static boolean deleteDirectoryRecursively(File path) 

Method Source Code

//package com.java2s;
import java.io.*;

public class Main {
    public static boolean deleteDirectoryRecursively(File path) {
        if (path.exists()) {
            File[] files = path.listFiles();
            for (int i = 0; i < files.length; i++) {
                if (files[i].isDirectory())
                    deleteDirectoryRecursively(files[i]);
                else
                    files[i].delete();//  ww w . j  a va 2  s .  c  om
            }
        }
        return path.delete();
    }
}

Related

  1. deleteDirectoryAndContentsRecursive(final File srcPath, final boolean deleteSrcDir)
  2. deleteDirectoryContents(File path)
  3. deleteDirectoryContents(String directoryPath, boolean deleteChildDirectories)
  4. deleteDirectoryIncludeContent(String folderPath)
  5. deleteDirectoryInternal(File path)
  6. deleteDirectoryRecursivly(String path)
  7. deleteDirectoryTree(String directoryPath)
  8. deleteDirRecursive(String dirPath)
  9. deleteDirRecursive(String path)