Function fs_extra::dir::copy[][src]

pub fn copy<P, Q>(from: P, to: Q, options: &CopyOptions) -> Result<u64> where
    P: AsRef<Path>,
    Q: AsRef<Path>, 

Copies the directory contents from one place to another using recursive method. 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:

Example

extern crate fs_extra;
use fs_extra::dir::copy;

let options = CopyOptions::new(); //Initialize default values for CopyOptions
// options.mirror_copy = true; // To mirror copy the whole structure of the source directory


// copy source/dir1 to target/dir1
copy("source/dir1", "target/dir1", &options)?;