From: cholm Date: Tue, 18 Nov 2014 09:55:37 +0000 (+0100) Subject: Script to extract ROOT file from ZIP archive in case we got that from the Grid X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=5327415cdcad963fb6d61558b6878853ea518fe8;p=u%2Fmrichter%2FAliRoot.git Script to extract ROOT file from ZIP archive in case we got that from the Grid --- diff --git a/PWGLF/FORWARD/trains/zip2root.sh b/PWGLF/FORWARD/trains/zip2root.sh new file mode 100755 index 00000000000..5f71638825d --- /dev/null +++ b/PWGLF/FORWARD/trains/zip2root.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +for i in $* ; do + t=`file $i` + case $t in + *ROOT*) continue ;; + *Zip*) mv $i ${i}.zip ;; # fall - through + *) mv $i $i.broken ; continue ;; + esac + + d=`mktemp -d` + unzip ${i}.zip -d ${d} + f=`echo ${i} | sed 's/_[0-9][_0-9]*\.root/.root/'` + if test -f ${d}/${f} ; then + mv ${d}/${f} ${i} + echo "Extracted ${f} to ${i}" + else + echo "${f} not found in ${i}.zip" + unzip -l ${i}.zip + fi + rm -rf ${d} +done + + +