Function std::fs::remove_file [] [src]

pub fn remove_file<P: AsRef<Path>>(path: P) -> Result<()>

Removes a file from the filesystem.

Note that there is no guarantee that the 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"));