Function fs_extra::dir::move_dir [−][src]
pub fn move_dir<P, Q>(from: P, to: Q, options: &CopyOptions) -> Result<u64> where
P: AsRef<Path>,
Q: AsRef<Path>,
Moves the directory contents from one place to another. This function will also copy the permission bits of the original files to destionation files (not for directories).
Errors
This function will return an error in the following situations, but is not limited to just these cases:
- This
from
path is not a directory. - This
from
directory does not exist. - Invalid folder name for
from
orto
. - The current process does not have the permission rights to access
from
or writeto
.
Example
ⓘ
extern crate fs_extra; use fs_extra::dir::move_dir; let options = CopyOptions::new(); //Initialize default values for CopyOptions // move source/dir1 to target/dir1 move_dir("source/dir1", "target/dir1", &options)?;