3 #---------------------------------------------------------------------
4 # Given a mother directory and a daughter directory, the script tryies
5 # to copy (ln -s) all the files in the mother dir into the daughter
6 # If the file alredy exists, the link is not created.
7 # Mother dir is optional. Default is $GENIE/config
10 # [--mother-dir] : Source directory
11 # [--daughter-dir] : Destination directory
12 # [--spline-file] : {no argument} Copies only files with format <vflavor>_on_<target>_<Process>.xml
13 #---------------------------------------------------------------------
17 if($_ eq '--mother-dir') { $mother_dir = $ARGV[$iarg+1]; }
18 if($_ eq '--daughter-dir') { $daughter_dir = $ARGV[$iarg+1]; }
19 if($_ eq '--spline-file') { $only_spline = 1; }
23 $mother_dir=$ENV{'GENIE'}."/config" unless defined $mother_dir;
24 $daughter_dir=$ENV{'PWD'} unless defined $daughter_dir;
26 print "Selected source dir: $mother_dir \n";
27 print "Selected target dir: $daughter_dir \n";
29 opendir(DIR, $mother_dir) or die $!;
31 while (my $file = readdir(DIR) ) {
34 next unless (-f "$mother_dir/$file");
36 # Use a regular expression to find files ending in .xml
37 next unless ($file =~ m/\.xml$/);
39 if ( defined $only_spline ) {
40 next unless ( index($file, "_on_") != -1 );
42 my $under_counter = $file =~ tr/_//;
43 next unless ( $under_counter == 3 );
46 if ( -f "$daughter_dir/$file" ) {
47 print "$file already present \n";
51 $link_command="ln -s $mother_dir/$file $daughter_dir";
52 print "$link_command \n";