extern crate tar;
      extern crate flate2;
      use std::fs::File;
      use flate2::Compression;
      use flate2::write::GzEncoder;
      
      fn main() -> Result<(), std::io::Error> {
          let tar_gz = File::create("compressed.tar.gz")?;
          let enc = GzEncoder::new(tar_gz, Compression::default());
          let mut tar = tar::Builder::new(enc);
          tar.append_dir_all("DIRECTORY_1", "DIRECTORY_1")?;
          Ok(())
      }
      Rust language logo

      Compress directories

      tarball
      compress
      Codiga's Rust Recipes

      Generate a tar.gz

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.