]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Script to extract ROOT file from ZIP archive in case we got that from the Grid
authorcholm <Christian.Holm.Christensen@cern.ch>
Tue, 18 Nov 2014 09:55:37 +0000 (10:55 +0100)
committercholm <Christian.Holm.Christensen@cern.ch>
Tue, 18 Nov 2014 09:55:37 +0000 (10:55 +0100)
PWGLF/FORWARD/trains/zip2root.sh [new file with mode: 0755]

diff --git a/PWGLF/FORWARD/trains/zip2root.sh b/PWGLF/FORWARD/trains/zip2root.sh
new file mode 100755 (executable)
index 0000000..5f71638
--- /dev/null
@@ -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 
+
+       
+