copy_folder

Function copy_folder 

Source
pub fn copy_folder<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q)
Expand description

Copies a folder and its contents from one location to another.

§Arguments

§Panics

If any error occurs while copying the folder or its contents.

§Note

  • The desination folder and/or any of its subdirectories will be created if they do not already exist.
  • Any existing files in the destination folder will be overwritten.

§Examples

§Using string literals

use file_io::copy_folder;

// Copy 'src/' to 'folder/src/'.
let from: &str = "src";
let to: &str = "folder/src";
copy_folder(from, to);

§Using Path references

use file_io::copy_folder;
use std::path::Path;

// Copy 'src/' to 'folder/src/'.
let from: &Path = Path::new("src");
let to: &Path = Path::new("folder/src");
copy_folder(from, to);