Function std::fs::remove_fileUnstable [-] [+] [src]

pub fn remove_file<P: AsPath + ?Sized>(path: &P) -> Result<()>

Remove a file from the underlying filesystem.

Example

fn main() { use std::fs; fs::remove_file("/some/file/path.txt"); }
use std::fs;

fs::remove_file("/some/file/path.txt");

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.