summaryrefslogtreecommitdiff
path: root/lib/sbin/CopyParFiles.pl
blob: 30c17efc76d5bf27a0fdb53bb27b027fbbbf27bf (plain)
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
#!/bin/perl -s
#
# Script to copy parameter files
# Version: $Id$

$home = `pwd`;
chop($home);

$config = $ARGV[0];

open(THORNLIST,"<configs/$config/ThornList") || die "ThornList not available";

if (! -d "thornparfiles")
{
    mkdir("thornparfiles", 0755) || die "Unable to create thornparfiles directory";
}

while (<THORNLIST>)
{
 /^(.*)\s/;
 $thorn=$1;
 print "Thorn $thorn\n";
 $thorn = "arrangements/$thorn/par";
 if (-d $thorn)
 {
   chdir $thorn;
   while ($parfile = <*.par>)
   { 
     if (-e "$home/thornparfiles/$parfile")
     {
        print "  $parfile exists, will not overwrite\n";
     }
     else
     {
       print "  Copying $parfile\n";
       system("cp $parfile $home/thornparfiles/$parfile");
     }
   }
   
   chdir "$home${sep}";

 }
}