remove incorrectly [un]compressed files

This commit is contained in:
Kolan Sh 2012-06-06 12:37:47 +04:00
parent efb946c754
commit 030b945b08
1 changed files with 7 additions and 7 deletions

View File

@ -20,9 +20,9 @@ extract () {
*.tar) tar xf $1 ;;
*.bz2) which lbunzip2 &>/dev/null \
&& lbunzip2 -kn$((`grep "^processor" /proc/cpuinfo -c`+1)) $1 \
|| bunzip2 -c $1 > ${1%.bz2} ;;
*.gz) gunzip -c $1 > ${1%.gz} ;;
*.xz) unxz -c $1 > ${1%.xz} ;;
|| bunzip2 -k $1 ;;
*.gz) gunzip -c $1 > ${1%.gz} || rm -f ${1%.gz} ;;
*.xz) unxz -k $1 ;;
*.rar) unrar x $1 ;;
*.zip) unzip $1 ;;
#*.Z) uncompress $1 ;;
@ -41,15 +41,15 @@ pk () {
echo "too many parameters to pk ()"
elif [ $1 ] ; then
case $1 in
t*b*z*) tar cjvf $2.tar.bz2 $2 ;; # FIXME: make parallel with lbzip2
t*b*z*) tar cjvf $2.tar.bz2 $2 ;;
t*g*z) tar czvf $2.tar.gz $2 ;;
t*x*|t*J*) tar cJvf $2.tar.xz $2 ;;
t*r) tar cpvf $2.tar $2 ;;
b*z*) which lbzip2 &>/dev/null \
&& lbzip2 -9 -kn$((`grep "^processor" /proc/cpuinfo -c`+1)) $2 \
|| bzip2 -9 -c $2 > $2.bz2 ;;
g*z) gzip -c -9 -n $2 > $2.gz ;;
x*z) xz -c -9 $2 > $2.xz ;;
|| bzip2 -9 -k $2 ;;
g*z) gzip -c -9 -n $2 > $2.gz || rm -f $2.gz ;;
x*z) xz -k -9 $2 ;;
rar) rar a $2.rar $2 -m5 ;;
zip) zip -9 -r $2.zip $2 ;;
#Z) ;;