public static void deleteRecursive(String path,boolean tryOnly){
  if (exists(path)) {
    if (isDirectory(path)) {
      for (      String s : newDirectoryStream(path)) {
        deleteRecursive(s,tryOnly);
      }
    }
    if (tryOnly) {
      tryDelete(path);
    }
 else {
      delete(path);
    }
  }
}

public static void deleteRecursive ( String path , boolean tryOnly ) { if ( exists ( path ) ) { if ( isDirectory ( path ) ) { for ( String s : newDirectoryStream ( path ) ) { deleteRecursive ( s , tryOnly ) ; } } if ( tryOnly ) { tryDelete ( path ) ; } else { delete ( path ) ; } } }
delete a directory or file and all subdirectories and files .
