Java File Path Delete deleteDirectoryRecursivly(String path)

Here you can find the source of deleteDirectoryRecursivly(String path)

Description

delete Directory Recursivly

License

Apache License

Declaration

public static void deleteDirectoryRecursivly(String path) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;

import java.io.IOException;

public class Main {

    public static void deleteDirectoryRecursivly(String path) throws IOException {
        File file = new File(path);
        deleteDirectoryRecursivly(file);
    }/*  ww  w.ja v  a2 s. c om*/

    public static void deleteDirectoryRecursivly(File dir) throws IOException {
        if (dir.isDirectory()) {
            String[] children = dir.list();
            for (int i = 0; i < children.length; i++) {
                deleteDirectoryRecursivly(new File(dir, children[i]));
            }
        }
        dir.delete();
    }
}

Related

  1. deleteDirectoryContents(File path)
  2. deleteDirectoryContents(String directoryPath, boolean deleteChildDirectories)
  3. deleteDirectoryIncludeContent(String folderPath)
  4. deleteDirectoryInternal(File path)
  5. deleteDirectoryRecursively(File path)
  6. deleteDirectoryTree(String directoryPath)
  7. deleteDirRecursive(String dirPath)
  8. deleteDirRecursive(String path)
  9. deleteDirs(File path)