copy_DLXfiles_from_dCache.sh 779 Bytes
Newer Older
Gernot Maier's avatar
Gernot Maier committed
1
2
#!/bin/bash
#
Gernot Maier's avatar
Gernot Maier committed
3
# copy DLX files from dCache (!!) files to target directory
Gernot Maier's avatar
Gernot Maier committed
4
5
6
7
# 
#

if [ $# -eq 0 ]; then
Gernot Maier's avatar
Gernot Maier committed
8
   echo "./copy_DLXfiles_from_dCache.sh <production>"
Gernot Maier's avatar
Gernot Maier committed
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
fi

FLIST=$(cat ${1}.list)

for P in $FLIST
do
   if [[ ${P} == *"gamma-diffuse"* ]]; then
        PP="gamma_cone"
   elif [[ ${P} == *"gamma"* ]]; then
        PP="gamma_onSource"
   elif [[ ${P} == *"proton"* ]]; then
        PP="proton"
   elif [[ ${P} == *"electron"* ]]; then
        PP="electron"
   else
        echo "unknown particle in $P"
        continue
   fi

   # directory per particle type
   mkdir -p ${1}/${PP}

   FF=$(cat ${1}/${P}.dCache.list)

   for F in $FF
   do
      FP=$(basename $F)
      if [[ ! -e ${1}/${PP}/${FP} ]]; then
          cp -v /pnfs/ifh.de/${F} ${1}/${PP}/
      fi
   done
done