Skip to main content

copy_dir_with_progress

Function copy_dir_with_progress 

Source
pub fn copy_dir_with_progress(src: &Path, dst: &Path) -> Result<(), SsgError>
Expand description

Copies directories with a progress bar for feedback.

Uses iterative traversal with an explicit stack to avoid unbounded recursion. Traversal depth is bounded by MAX_DIR_DEPTH.

ยงExamples

use ssg::fs_ops::copy_dir_with_progress;
use tempfile::tempdir;
use std::fs;

let src = tempdir().unwrap();
let dst = tempdir().unwrap();
fs::write(src.path().join("a.txt"), "x").unwrap();
copy_dir_with_progress(src.path(), dst.path()).unwrap();
assert!(dst.path().join("a.txt").exists());