File.delete_if_exists
delete_if_existsrecursive
Documentation
Deletes the file if it exists on disk.
Arguments
recursive: If the target is a non-empty directory, it will only be removed if this is set toTrue. Defaults toFalse, meaning that the operation will fail if the directory is not empty. This option has no effect for files, data links or symlinks.
Examples
Delete a file if it exists on disk.
import Standard.Examples
example_del_if_exists = Examples.scratch_file.delete_if_exists