File.delete
deleterecursive
Documentation
Deletes the file.
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
Create a file and then delete it.
import Standard.Examples
example_delete =
file = Examples.data_dir / "my_file"
file.write_text "hello"
file.delete