File: clone_or_copy.rs

package info (click to toggle)
rust-reflink-copy 0.1.26-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 248 kB
  • sloc: makefile: 2
file content (18 lines) | stat: -rw-r--r-- 545 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// cargo run --example clone_or_copy V:\file.bin V:\file-clone.bin

fn main() -> std::io::Result<()> {
    let args: Vec<_> = std::env::args().collect();
    if args.len() < 3 {
        eprintln!("Usage: {} <source_file> <target_file>", args[0]);
        return Ok(());
    }
    let src_file = &args[1];
    let tgt_file = &args[2];

    let result = reflink_copy::reflink_or_copy(src_file, tgt_file)?;
    match result {
        Some(_) => println!("File has been copied"),
        None => println!("File has been cloned"),
    }
    Ok(())
}