Java File Path Delete deleteFolder(String path)

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

Description

delete Folder

License

Open Source License

Declaration

public static boolean deleteFolder(String path) 

Method Source Code

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

import java.io.*;

public class Main {
    public static boolean deleteFolder(String path) {
        return deleteFolder(new File(path));
    }/*from w  w w.  java 2  s  .  co m*/

    public static boolean deleteFolder(File file) {
        if (file.isDirectory()) {
            for (File other : file.listFiles()) {
                if (!deleteFolder(other.getPath()))
                    return false;
            }
            if (!file.delete())
                return false;
        } else {
            if (!file.delete())
                return false;
        }
        return true;
    }
}

Related

  1. deleteFolder(String filePath)
  2. deleteFolder(String folderPath)
  3. deleteFolder(String folderPath)
  4. deleteFolder(String folderPath)
  5. deleteFolder(String path)
  6. deleteFolder(String path)
  7. deleteFolder(String path)
  8. deleteFolder(String path)
  9. deleteFolder(String path)