Java File Path Delete deleteDirectory(String path)

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

Description

delete Directory

License

Open Source License

Declaration

public static boolean deleteDirectory(String path) 

Method Source Code


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

import java.io.*;

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

    public static boolean deleteDirectory(File path) {
        if (path.isDirectory()) {
            for (File file : path.listFiles()) {
                deleteDirectory(file);
            }
        }
        return path.delete();
    }

    public static boolean delete(String name) {
        File was_file = new File(name);
        System.err.println("[IOUtils] deleting: " + was_file.getAbsolutePath());
        return was_file.delete();
    }
}

Related

  1. deleteDirectory(String path)
  2. deleteDirectory(String path)
  3. deleteDirectory(String path)
  4. deleteDirectory(String path)
  5. deleteDirectory(String path)
  6. deleteDirectory(String path)
  7. deleteDirectory(String sPath)
  8. deleteDirectoryAndContents(final File srcPath)
  9. deleteDirectoryAndContentsRecursive(final File srcPath, final boolean deleteSrcDir)