Created
October 2, 2013 04:29
-
-
Save rietta/6789165 to your computer and use it in GitHub Desktop.
Tarbar a directory and move the original to the Trash. First, install these from Hamebrew:
brew install trash
brew install pigz
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 | |
# Archive a directory into a compressed tar file | |
# and prepare a text file that lists all of the files in each archive. | |
### | |
# The trash command is OS X specific ane requires a 3rd party tool - | |
# brew install trash | |
# brew install pigz | |
### | |
if [ -d "$1" ]; then | |
echo "Compressing and preparing a file listing $1..." | |
#tar -jcf "${1%/}.tar.bz2" "$1" && tar -jtvf "${1%/}.tar.bz2" > "${1%/}.tar.txt" && trash "$1" | |
tar --use-compress-program=pbzip2 -cf "${1%/}.tar.bz2" "$1" && tar -jtvf "${1%/}.tar.bz2" > "${1%/}.tar.txt" && trash "$1" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment