Created
April 18, 2021 11:02
-
-
Save landsman/d112364af04f052d382a27fda285407d to your computer and use it in GitHub Desktop.
compress file with progress bar
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
function compress () { | |
if [ -z "$1" ]; then | |
# display usage if no parameters given | |
echo "Usage: compress <path/folder-or-file> <new-file.tar.gz>" | |
return 1 | |
fi | |
tar cf - $1 -P | pv -s $(du -sb $1 | awk '{print $1}') | gzip > $2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment