Function clonedir_lib::clonedir[][src]

pub fn clonedir<A: AsRef<Path>, B: AsRef<Path>>(from: A, to: B) -> Result<()>

Clones a directory with reflink https://docs.rs/reflink/*/reflink/index.html Some file systems implement COW (copy on write) functionality in order to speed up file copies. On a high level, the new file does not actually get copied, but shares the same on-disk data with the source file. As soon as one of the files is modified, the actual copying is done by the underlying OS.

Examples

use std::fs;
use std::io::prelude::*;

fn main() {
    clonedir_lib::clonedir("src", "tmp/src").expect("error downloading");
    let contents = fs::read_to_string("tmp/src/lib.rs").expect("error reading file");
    assert!(contents.starts_with("extern"));
}