Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Java

Idiom #155 Delete file

Delete from filesystem the file having path filepath.

import java.io.File;
new File(filepath).delete();
import static java.nio.file.Files.deleteIfExists;
import static java.nio.file.Path.of;
deleteIfExists(of(filepath));
with Ada.Directories;
Ada.Directories.Delete_File (filepath);

New implementation...
< >
programming-idioms.org