Function fs_extra::file::copy_with_progress[][src]

pub fn copy_with_progress<P, Q, F>(
    from: P,
    to: Q,
    options: &CopyOptions,
    progress_handler: F
) -> Result<u64> where
    P: AsRef<Path>,
    Q: AsRef<Path>,
    F: FnMut(TransitProcess), 

Copies the contents of one file to another with recept information about process. This function will also copy the permission bits of the original file to the destination file.

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::file::copy_with_progress;

let options = CopyOptions::new(); //Initialize default values for CopyOptions
let handle = |process_info: TransitProcess|  println!("{}", process_info.total_bytes);

// Copy dir1/foo.txt to dir2/foo.txt
copy_with_progress("dir1/foo.txt", "dir2/foo.txt", &options, handle)?;