create a diroctory only if input is exitsting
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 12 May 2010 13:32:39 +0000 (13:32 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 12 May 2010 13:32:39 +0000 (13:32 +0000)
(Marian)

TPC/scripts/makeWorkspace.sh

index b56a5824f70b9a20e57c7939eaeb312477c3e36a..e9547afe8be93fe82b0d95578494653ce7010b2f 100755 (executable)
@@ -9,19 +9,30 @@
 #
 mydir=`pwd`
 runlist=$1
 #
 mydir=`pwd`
 runlist=$1
+minfiles=$2
 touch raw.list
 touch esd.list
 for adir in `cat $runlist`; do
 touch raw.list
 touch esd.list
 for adir in `cat $runlist`; do
-    echo Creating dir $adir
-    mkdirhier $adir;
-    rm -f raw${adir}.txt
-    rm -f esd${adir}.txt
-    cat  $mydir/raw.list | grep $adir >raw${adir}.txt
-    cat  $mydir/esd.list | grep $adir >esd${adir}.txt
-    cp raw${adir}.txt   ${adir}/raw.txt
-    cp esd${adir}.txt   ${adir}/esd.txt
-    cp raw${adir}.txt   ${adir}/raw.txt.Good
-    cp esd${adir}.txt   ${adir}/esd.txt.Good
+    rm -f tmp.rlist
+    cat  $mydir/raw.list | grep $adir >>tmp.rlist
+    cat  $mydir/esd.list | grep $adir >>tmp.rlist
+    nfiles=`wc -l <tmp.rlist`
+    echo Run $arun nfiles $nfiles 
+    rm tmp.rlist
+    if [ $nfiles -gt $minfiles ] ; then
+       echo Creating dir $adir
+       mkdirhier $adir;
+       rm -f raw${adir}.txt
+       rm -f esd${adir}.txt
+       cat  $mydir/raw.list | grep $adir >raw${adir}.txt
+       cat  $mydir/esd.list | grep $adir >esd${adir}.txt
+       cp raw${adir}.txt   ${adir}/raw.txt
+       cp esd${adir}.txt   ${adir}/esd.txt
+       cp raw${adir}.txt   ${adir}/raw.txt.Good
+       cp esd${adir}.txt   ${adir}/esd.txt.Good
+    else
+      echo No input for run $adir  
+    fi;        
 done;
 
 
 done;