Zip archive

zip_archive is a library that select 7z executable that are depending on the operating system, and run it with multithread.

Requirements

Windows 10

  1. Install 7-Zip.
  2. Find 7z.exe file in installed 7z folder and add it to path. Or place 7z.exe in project root folder.

macOS

  1. Download 7-Zip console version executable for macOS.
  2. Place 7zz executable to home directory.

Examples

let origin = PathBuf::from("./origin"); let dest = PathBuf::from("./dest"); let thread_count = 4;

let mut archiver = Archiver::new(); archiver.push(origin); archiver.setdestination(dest); archiver.setthreadcount(threadcount);

match archiver.archive(){ Ok(_) => (), Err(e) => println!("Cannot archive the directory! {}", e), }; ```

let origin = PathBuf::from("./origin"); let dest = PathBuf::from("./dest");

let mut archiver = Archiver::new(); archiver.pushfromiter(vec!["./origin/dir1", "./origin/dir2", "./origin/dir3"].intoiter()); archiver.setdestination(dest); match archiver.archive(){ Ok(_) => (), Err(e) => println!("Cannot archive the directory! {}", e), }; ```

let origin = PathBuf::from("./origin"); // Change to the wanted directory. let dest = PathBuf::from("./dest");

let mut archiver = Archiver::new(); archiver.pushfromiter(getdirlist(origin).unwrap().iter()); archiver.setdestination(dest); match archiver.archive(){ Ok() => (), Err(e) => println!("Cannot archive the directory! {}", e), }; ```