2 use std::path::PathBuf;
3 use std::fs::{copy, create_dir_all, read_dir};
5 pub fn recursively_copy(source: &PathBuf, target: &PathBuf) -> Result<()> {
6 let entries = read_dir(source)?;
9 let entry_type = entry.file_type()?;
10 let entry_name = entry.file_name();
11 let entry_source = entry.path();
12 let entry_target = target.join(entry_name);
14 if entry_type.is_dir() {
15 create_dir_all(&entry_target)?;
16 recursively_copy(&entry_source, &entry_target)?;
18 copy(&entry_source, &entry_target)?;