[][src]Function rfm::mv

pub fn mv(from: &Vec<&PathBuf>, to: &PathBuf) -> Result<()>

Moves files and directories, including nested files and directories. from - takes a list of paths of what you want to copy. to - destination path.

Errors

This function will return an error in the following situations, but is not limited to just these case:

  • Param from contains file or directory does not exist.
  • Param from contains file or directory with invalid name.
  • The current process does not have the permission to access to input params.

Example

ⓘThis example is not tested
 extern crate rfm;
 use rfm::mv;

 let file = std::path::Path::new("./file.txt").to_path_buf();
 let dir = std::path::Path::new("./dir").to_path_buf();
 let elements: Vec<&std::path::PathBuf> = vec![&file, &dir];
 let to = std::path::Path::new("./tests/expected_files").to_path_buf();

 mv(&elements, &to)?;