Skip to content

Instantly share code, notes, and snippets.

@SaicharanKandukuri
Created April 7, 2022 07:02
Show Gist options
  • Save SaicharanKandukuri/c867945c0542337d6c16eb8da3fb701a to your computer and use it in GitHub Desktop.
Save SaicharanKandukuri/c867945c0542337d6c16eb8da3fb701a to your computer and use it in GitHub Desktop.
A Script for compressing folders with lz4
#!/usr/bin/env bash
# Usage: bash clz.sh foldername filenametocompress
target=$2
target_source=$1
tar \
--exclude="${target_source}"${0} \
--exclude="${target_source}${target}.tar.lz" \
--exclude-caches-all \
-cpf \
- "${target_source}" -P \
| pv -s $(($(du -skx "${target_source}" | awk '{print $1}') * 1024)) |\
lz4 -9 > "${target}".tar.lz # use high compression
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment