Function std::io::fs::rename[src]

pub fn rename(from: &Path, to: &Path) -> IoResult<()>

Rename a file or directory to a new name.

Example

fn main() { #![allow(unused_must_use)] use std::io::fs; fs::rename(&Path::new("foo"), &Path::new("bar")); }
use std::io::fs;

fs::rename(&Path::new("foo"), &Path::new("bar"));

Error

Will return an error if the provided path doesn't exist, the process lacks permissions to view the contents, or if some other intermittent I/O error occurs.