Last active
August 29, 2015 14:02
-
-
Save jepio/9296ae437d2ed14dbff8 to your computer and use it in GitHub Desktop.
Progress bar while tar'ing.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [[ $# -ne 1 ]]; then | |
echo "Specify one folder to compress" | |
exit 1 | |
fi | |
if [[ -d $1 ]]; then | |
folder=`basename $1` | |
size=`du -sb $1 | cut -f 1` | |
tar cfp - $1 | pv -perbt -s $size | bzip2 -c > $folder.tar.bz2 | |
else | |
echo "It needs to be a folder" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ofcourse you can replace
bzip2
withgzip
.The options for
pv
areprogress eta rate bytes timer
. You can skip these modifiers, they are the default anyway.