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 .