public static void delete(String path) throws IOException {
    if (!Files.deleteIfExists(Paths.get(path))) {
      throw new IOException("Failed to delete " + path);
    }
  }
public static void delete ( String path ) throws IOException { if ( ! Files . deleteIfExists ( Paths . get ( path ) ) ) { throw new IOException ( "Failed to delete " + path ) ; } }
Deletes the file or directory.

@param path pathname string of file or directory