Java File Path Delete deleteDir(File directory)

Here you can find the source of deleteDir(File directory)

Description

delete Dir

Declaration

private static void deleteDir(File directory) 

Method Source Code


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

public class Main {
    private static void deleteDir(File directory) {
        if (directory.exists()) {
            String[] children = directory.list();
            if (children != null) {
                for (int i = 0; i < children.length; i++) {
                    deleteDir(new File(directory, children[i]));
                }//from   ww  w. j  a v a  2s.c  o m
            }
        }
        directory.delete();
    }
}

Related

  1. deleteDir(File dir, boolean deleteRoot)
  2. deleteDir(File dir, boolean deleteSelf)
  3. deleteDir(File dir, int depth, boolean deleteRootDirectory)
  4. deleteDir(File dir, String dirPath)
  5. deleteDir(File directory)
  6. deleteDir(File directory)
  7. deleteDir(File directory)
  8. deleteDir(File directory, boolean removeAll)
  9. deleteDir(File dirFile)