code: public static final boolean deleteDirectory(final File path) {
      if (!path.isDirectory())
        throw new IllegalArgumentException("path must be a directory");
      if (path == null)
        return false;
      if (!path.exists())
        return true;
  
      try {
        File curr;
        Stack<File> stack = new Stack<File>();
        Stack<File> dir_stack = new Stack<File>();
        stack.push(path);
  
        while(!stack.empty() && (curr = stack.pop()) != null) {
          for(File potential : curr.listFiles()) {
            if (potential.isDirectory()) {
              stack.push(potential);
              dir_stack.push(potential);
            } else {
              potential.delete();
            }
          }
        }
  
        while(!dir_stack.empty() && (curr = dir_stack.pop()) != null) {
          curr.delete();
        }
  
        path.delete();
  
        return true;
      } catch(Throwable t) {
        return false;
      }
    }
docs: Uses an iterative algorithm to recursively delete an entire directory and all its subdirectories.
  Could be revised later for Java v1.7 compatibility by using Files.walkFileTree().
  
  @param path The directory to be deleted.
  @return <code>true</code> if the entire directory and all subdirectories were removed; <code>false</code> otherwise.
  @see <a href="http://fahdshariff.blogspot.com/2011/08/java-7-deleting-directory-by-walking.html">http://fahdshariff.blogspot.com/2011/08/java-7-deleting-directory-by-walking.html</a>