In ifdhc v1_3_2 and later, the ifdh renameOutput exec:script command will call script to do the renaming. The script will be handed as argv[1] the name of the file that ifdh addOutput and ifdh copyBackOutput uses to keep track of output files.

So the file you are given looks like:

outfile1.root /some/input/file/infile.root
outfile2.root /some/input/file/infile2.root

It should read this file, rename the files as desired, and replace the file

newoutfile1.root newoutfile1.root
newoutfile2.root newoutfile2.root

so that a following ifdh renameOutput s/foo/bar/ command will work.

Intenally, this is actually how the renameOutput s/foo/bar works, it really runs
the following perl script:

while (<>) {
    print STDERR  "got line $_";
    next unless $pair[0] && $pair[1];
    $dir = $pair[0];
    $pair[0] =~ s{.*/}{};
    $dir =~ s{/?$pair[0]\\Z}{};
    print STDERR  "got dir $dir";
    $pair[1] =~ s{.*/}{};
    $pair[1] =~ s/foo/bar/;
    rename("$dir/$pair[0]", "$dir/$pair[1]");
    print STDERR "renaming $dir/$pair[0] to $dir/$pair[1]\\n";
    s{.*}{$dir/$pair[1] $dir/$pair[1]};
    print STDERR "result line: $_";