Index: trunk/ippToPsps/perl/getSmfForThisBatch.pl
===================================================================
--- trunk/ippToPsps/perl/getSmfForThisBatch.pl	(revision 29083)
+++ trunk/ippToPsps/perl/getSmfForThisBatch.pl	(revision 29083)
@@ -0,0 +1,82 @@
+#!/usr/bin/env perl
+
+use warnings;
+use strict;
+
+use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
+use ippToPsps::Gpc1Db;
+use ippToPsps::IppToPspsDb;
+use PS::IPP::Config 1.01 qw( :standard );
+
+my $camera = undef;
+my $singleBatch = undef;
+my $verbose = undef;
+my $save_temps = undef;
+
+GetOptions(
+        'batch|b=s' => \$singleBatch,
+        'verbose|v' => \$verbose,
+        'save_temps|t' => \$save_temps,
+        'camera|c' => \$camera,
+        );
+
+my $quit = 0;
+print "\n*******************************************************************************\n";
+print "* \n";
+if (@ARGV) {
+    $quit=1;
+    print "* UNKNKOWN: option                          @ARGV\n";
+}
+if (!defined $singleBatch) {
+    $quit=1;
+    print "* REQUIRED: need to provide a batch   -b <batch>\n";
+}
+if (!defined $verbose) {
+    $camera = "GPC1";
+    print "* OPTIONAL: select a camera                 -c                   (default = $camera)\n";
+}
+if (!defined $verbose) {
+    $verbose = 0;
+    print "* OPTIONAL: run in verbose mode             -v                   (default = $verbose)\n";
+}
+if (!defined $save_temps) {
+    $save_temps = 0;
+    print "* OPTIONAL: keep temp files                 -t                   (default = $save_temps)\n";
+}
+
+print "*\n*******************************************************************************\n";
+
+if ($quit) { exit; }
+
+my $gpc1Db = new ippToPsps::Gpc1Db("gpc1", "ippdb01", "ippuser", "ippuser", $verbose, $save_temps);
+my $ippToPspsDb = new ippToPsps::IppToPspsDb("ippToPsps", "ippdb01", "ipp", "ipp", $verbose, $save_temps);
+my $ipprc = PS::IPP::Config->new($camera) or (warn "Can't get camera configuration" and exit($PS_EXIT_CONFIG_ERROR));
+
+
+my $batches;
+my $numOfBatches;
+
+if (defined $singleBatch ) { $numOfBatches = $ippToPspsDb->getSingleBatch($singleBatch, \$batches);}
+if ($numOfBatches < 1) {return 0;}
+
+
+# loop round batches
+my $batch;
+my $numChecked = 0;
+foreach $batch ( @{$batches} ) {
+    my ($timestamp, $expId, $batchId, $surveyType, $deleted, $dvoDb) =  @{$batch};
+
+    print "* found $timestamp, $expId, $batchId, $surveyType, $deleted $dvoDb\n";
+
+    my $nebPath = $gpc1Db->getCameraStageSmfForThisDvoDb($dvoDb, $expId);
+    if (!$nebPath) { print "* Could not determind neb path for SMF\n"; exit; }
+
+    # get real filename from neb 'key'
+    my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT",$nebPath) or return 0;
+    my $realFile = $ipprc->file_resolve($fpaObjects) or return 0;
+
+    print "$realFile\n";
+
+}
+
+
