Function copy_contents

Source
pub fn copy_contents<P, Q>(from: P, to: Q, overwrite: bool) -> Result<u64>
where P: AsRef<Path>, Q: AsRef<Path>,
Expand description

Copies the entire contents of a folder to another location.

§Parameters

  • from: The source directory path.
  • to: The destination directory path.
  • overwrite: A boolean indicating whether to overwrite existing files in the destination.

§Returns

A Result that is Ok(u64) representing the total number of bytes copied, or an Err wrapping an anyhow::Error if an error occurred.

§Errors

This function will return an error if any file operation fails.