Function std::fs::remove_file
[−]
[src]
pub fn remove_file<P: AsRef<Path>>(path: P) -> Result<()>
Removes a file from the underlying filesystem.
Note that, just because an unlink call was successful, it is not guaranteed that a file is immediately deleted (e.g. depending on platform, other open file descriptors may prevent immediate removal).
Errors
This function will return an error if path
points to a directory, if the
user lacks permissions to remove the file, or if some other filesystem-level
error occurs.
Examples
fn main() { use std::fs; fn foo() -> std::io::Result<()> { try!(fs::remove_file("a.txt")); Ok(()) } }use std::fs; try!(fs::remove_file("a.txt"));