view imgtconvert.sh @ 0:7d97fa9a0423 draft

Uploaded
author davidvanzessen
date Fri, 09 May 2014 09:35:32 -0400
parents
children 24d5d9120d93
line wrap: on
line source

#!/bin/bash
dir="$(cd "$(dirname "$0")" && pwd)"
mkdir $PWD/$2_$3


#!/bin/bash
f=$(file $1)
zip7Type="7-zip archive"
tarType="tar archive"
bzip2Type="bzip2 compressed"
gzipType="gzip compressed"
zipType="Zip archive"
rarType="RAR archive"

if [[ "$f" == *"$zip7Type"* ]]; then
	echo "7-zip"
	echo "Trying: 7za e $1 -o$PWD/$2_$3/"
	7za e $1 -o$PWD/$2_$3/
fi

if [[ "$f" == *"$tarType"* ]]
then
	echo "tar archive"
	echo "Trying: tar xvf $1 -C $PWD/$2_$3/"
	tar xvf $1 -C $PWD/$2_$3/
fi

if [[ "$f" == *"$bzip2Type"* ]]
then
	echo "bzip2 compressed data"
	echo "Trying: tar jxf $1 -C $PWD/$2_$3/"
	tar jxf $1 -C $PWD/$2_$3/
fi

if [[ "$f" == *"$gzipType"* ]]
then
	echo "gzip compressed data"
	echo "Trying: tar xvzf $1 -C $PWD/$2_$3/"
	tar xvzf $1 -C $PWD/$2_$3/
fi

if [[ "$f" == *"$zipType"* ]]
then
	echo "Zip archive"
	echo "Trying: unzip $1 -d $PWD/$2_$3/"
	unzip $1 -d $PWD/$2_$3/
fi

if [[ "$f" == *"$rarType"* ]]
then
	echo "RAR archive"
	echo "Trying: unrar e $1 $PWD/$2_$3/"
	unrar e $1 $PWD/$2_$3/
fi
find $PWD/$2_$3/ -type f |  grep -v "1_Summary_\|5_AA-sequences_\|6_Junction_" | xargs rm -f
python $dir/imgtconvert.py --input $PWD/$2_$3 --output $4