-
Notifications
You must be signed in to change notification settings - Fork 2
/
copyfiles.sh
executable file
·58 lines (35 loc) · 1.01 KB
/
copyfiles.sh
1
2
3
4
5
6
7
8
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/zsh
crabid=(
"config/Last2DESY_MultiJet1Parked_Run2012D-part1_10Dec2012-v1_ntuplewriter_ttbsm_53_plusprunedcfg_sge_22"
)
iteracount=0
for listname in ${crabid}; do
numberfiles=$(wc -l ${listname} | awk '{print $1}')
echo "There are ${numberfiles} jobs for the id ${listname}"
outputdir="/nfs/dust/cms/user/usaiem/mj/part1sge2/"
if [ -e ${outputdir} ]; then
echo "Output directory ${outputdir} already exists"
else
mkdir ${outputdir}
if [[ $? != 0 ]]; then
echo "Problem mkdir"
exit 1
fi
fi
i=1
while [ $i -le $numberfiles ]; do
filename=$(cut -d'
' -f$i ${listname})
filename=$(echo ${filename} | awk 'BEGIN{FS="pnfs"} {print $2}'| awk 'BEGIN{FS="\""} {print $1}')
filename=$(echo "/pnfs${filename}")
echo "copying gsidcap://dcache-cms-gsidcap.desy.de:22128/${filename} to ${outputdir}"
dccp gsidcap://dcache-cms-gsidcap.desy.de:22128/${filename} ${outputdir}
if [[ $? != 0 ]]; then
echo "Problem copying"
exit 2
fi
let "iteracount=iteracount +1"
let "i=i + 1"
done
done
echo "Total ${iteracount} files"