Skip to content

Instantly share code, notes, and snippets.

@jepio
Last active August 29, 2015 14:02
Show Gist options
  • Save jepio/9296ae437d2ed14dbff8 to your computer and use it in GitHub Desktop.
Save jepio/9296ae437d2ed14dbff8 to your computer and use it in GitHub Desktop.
Progress bar while tar'ing.
#!/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
@jepio
Copy link
Author

jepio commented Jun 21, 2014

Ofcourse you can replace bzip2 with gzip.
The options for pv are progress eta rate bytes timer. You can skip these modifiers, they are the default anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment