~cyplo/dotfiles

ref: 83ddcc09dc68389b129d598722eca9e90a6dff33 dotfiles/tools/compress-large-dir -rwxr-xr-x 279 bytes
83ddcc09 — Cyryl Płotnicki remove broken i3 msg call 1 year, 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash
set -eo pipefail

if [ -z $1 ]; then
    echo "Usage: $0 dir"
    exit 1
fi

dir="${1%/*}"

if [ ! -e $dir ]; then
  echo "$dir doesn't exist"
  exit 1
fi

tar -cf - $dir | pv -ptabI -s $(du -sb $dir | awk '{print $1}') | pixz -9 -f 3 -p $((`nproc`-1)) > $dir.tar.xz