[][src]Function fungus::sys::move_p

pub fn move_p<T: AsRef<Path>, U: AsRef<Path>>(src: T, dst: U) -> FuResult<()>

Move a file or directory handling path expansion and globbing. Replaces destination files if exist but always moves src into dst if dst is an existing directory.

Examples

use fungus::prelude::*;

let tmpdir = PathBuf::from("tests/temp").abs().unwrap().mash("file_doc_copy");
assert!(sys::remove_all(&tmpdir).is_ok());
assert!(sys::mkdir(&tmpdir).is_ok());
let file1 = tmpdir.mash("file1");
let file2 = tmpdir.mash("file2");
assert!(sys::touch(&file1).is_ok());
assert!(sys::move_p(&file1, &file2).is_ok());
assert_eq!(file1.exists(), false);
assert_eq!(file2.exists(), true);
assert!(sys::remove_all(&tmpdir).is_ok());