public static boolean deleteDirectoryRecursively(File directory){
  if (!directory.exists() || !directory.isDirectory()) {
    return false;
  }
  for (  File entry : directory.listFiles()) {
    if (entry.isDirectory()) {
      deleteDirectoryRecursively(entry);
    }
    if (!entry.delete()) {
      return false;
    }
  }
  return directory.delete();
}

public static boolean deleteDirectoryRecursively ( File directory ) { if ( ! directory . exists ( ) || ! directory . isDirectory ( ) ) { return false ; } for ( File entry : directory . listFiles ( ) ) { if ( entry . isDirectory ( ) ) { deleteDirectoryRecursively ( entry ) ; } if ( ! entry . delete ( ) ) { return false ; } } return directory . delete ( ) ; }
deletes the given directory and all it ' s contents , including sub - directories .
