Function std::old_io::fs::unlinkUnstable [-] [+] [src]

pub fn unlink(path: &Path) -> IoResult<()>

Unlink a file from the underlying filesystem.

Example

fn main() { #![allow(unused_must_use)] use std::old_io::fs; let p = Path::new("/some/file/path.txt"); fs::unlink(&p); }
use std::old_io::fs;

let p = Path::new("/some/file/path.txt");
fs::unlink(&p);

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)

Error

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.