Delete a file: Difference between revisions

Content added Content deleted
mNo edit summary
Line 1,819: Line 1,819:
IO.Directory.Delete(IO.Path.DirectorySeparatorChar & "docs")
IO.Directory.Delete(IO.Path.DirectorySeparatorChar & "docs")
IO.File.Delete(IO.Path.DirectorySeparatorChar & "output.txt")</syntaxhighlight>
IO.File.Delete(IO.Path.DirectorySeparatorChar & "output.txt")</syntaxhighlight>

=={{header|V (Vlang)}}==
<syntaxhighlight lang="Rust">
import os

fn main() {
os.rm("./input.txt") or {println(err) exit(-1)}
os.rmdir("./docs") or {println(err) exit(-2)} // os.rmdir_all, recursively removes specified directory
// check if file exists
if os.is_file("./input.txt") == true {println("Found file!")}
else {println("File was not found!")}
// check if directory exists
if os.is_dir("./docs") == true {println("Found directory!")}
else {println("Directory was not found!")}
}
</syntaxhighlight>


=={{header|Wren}}==
=={{header|Wren}}==