dotfiles/tools/compress-large-dir
2018-04-07 15:07:45 +01:00

16 lines
279 B
Bash
Executable file

#!/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