Java Delete Directory deleteDirectory(String directory)

Here you can find the source of deleteDirectory(String directory)

Description

delete Directory

License

Open Source License

Declaration

public static boolean deleteDirectory(String directory) 

Method Source Code


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

public class Main {
    public static boolean deleteDirectory(String directory) {
        return deleteDirectory(new File(directory));
    }/*from   ww  w. j  a v  a  2 s.c  o  m*/

    public static boolean deleteDirectory(File dir) {
        File[] files = dir.listFiles();

        if (files != null) {
            for (File f : files) {
                f.delete();
            }
            dir.delete();
        }
        return !dir.exists();
    }
}

Related

  1. deleteDirectory(final String targetDir)
  2. deleteDirectory(IProgressMonitor monitor, File directory)
  3. deleteDirectory(IProgressMonitor monitor, File directory, File base, int step)
  4. deleteDirectory(String dir)
  5. deleteDirectory(String directory)
  6. deleteDirectory(String directoryName)
  7. deleteDirectory(String directoryName)
  8. deleteDirectory(String dirName)
  9. deleteDirectory(String dirName)