package sample;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
public class DeleteExample {
public static void main(String[] args) throws Exception {
Path target = Paths.get("temp/bar/note2024.txt");
if (Files.exists(target)) {
Files.delete(target);
}
}
}
Run