-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlistOfDccapFiles.sh
More file actions
49 lines (36 loc) · 973 Bytes
/
listOfDccapFiles.sh
File metadata and controls
49 lines (36 loc) · 973 Bytes
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
# This is a small macro to list all the files contained in a directory.
#Syntax:
# source listOfFiles.sh arg1 arg2 [arg3]
# arg1 is the path to the directory in which we want to ls
# arg2 is the path to the target directory in which we want to copy the list of ile
# arg3 is an optionnal argument allowing to search for file containing "arg2" in their names
if [ -f "$2/files.txt" ]
then
echo "files.txt exist!"
echo "Deleting old file ..."
rm -f $2/files.txt
fi
if [ -f "$2/all.root" ]
then
echo "all.root exist!"
echo "Deleting old file ..."
rm -f $2/all.root
fi
# make the txt file containing all the files
if [[ $3 ]]
then
for file in `ls $1 | grep $3`
do
printf "dcap://maite.iihe.ac.be/$1$file " >> $2/files.txt
done
fi
if [[ ! $3 ]]
then
for file in `ls $1`
do
printf "dcap://maite.iihe.ac.be/$1$file " >> $2/files.txt
done
fi
# hadding
rootfiles=`cat $2/files.txt`
hadd $2/all.root $rootfiles