public static void deleteDirectory(File directory) throws IOException {
  if (!directory.exists()) {
    return;
  }
  if (!isSymlink(directory)) {
    cleanDirectory(directory);
  }
  Files.delete(directory.toPath());
}

public static void deleteDirectory ( File directory ) throws IOException { if ( ! directory . exists ( ) ) { return ; } if ( ! isSymlink ( directory ) ) { cleanDirectory ( directory ) ; } Files . delete ( directory . toPath ( ) ) ; }
deletes a directory recursively .
