Index: trunk/ippScripts/scripts/ipp_datapath.pl
===================================================================
--- trunk/ippScripts/scripts/ipp_datapath.pl	(revision 17662)
+++ trunk/ippScripts/scripts/ipp_datapath.pl	(revision 17663)
@@ -3,11 +3,20 @@
 use warnings;
 use strict;
+use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
 
 use PS::IPP::Config;
 my $ipprc = PS::IPP::Config->new();
 
+my $touch;
+
+GetOptions(
+    'touch'     => \$touch,
+);
+
 die "No filename specified.\n" if scalar @ARGV != 1;
 
-print $ipprc->file_resolve(shift @ARGV) . "\n";
+my $filename = shift @ARGV;
+
+print $ipprc->file_resolve($filename, $touch) . "\n";
 
 1;
Index: trunk/ippScripts/scripts/ipp_filename.pl
===================================================================
--- trunk/ippScripts/scripts/ipp_filename.pl	(revision 17662)
+++ trunk/ippScripts/scripts/ipp_filename.pl	(revision 17663)
@@ -14,5 +14,5 @@
 my $ipprc = PS::IPP::Config->new();
   
-my ($filerule, $class_id, $basename, $camera);
+my ($filerule, $class_id, $basename, $camera, $touch);
 
 GetOptions('filerule=s'    => \$filerule,
@@ -20,4 +20,5 @@
 	   'basename=s'    => \$basename,
 	   'camera|c=s'    => \$camera,
+           'touch'         => \$touch,
 	   ) or pod2usage( 2 );
 
@@ -41,5 +42,5 @@
 #print "$filename\n";
 
-my $realname = $ipprc->file_resolve( $filename );
+my $realname = $ipprc->file_resolve( $filename, $touch );
 print "$realname\n";
 
Index: trunk/ippScripts/scripts/ipp_image_path.pl
===================================================================
--- trunk/ippScripts/scripts/ipp_image_path.pl	(revision 17663)
+++ trunk/ippScripts/scripts/ipp_image_path.pl	(revision 17663)
@@ -0,0 +1,126 @@
+#!/usr/bin/env perl
+
+# ipp_image_path.pl print out the unix path name(s) for rawImage files for an exposure
+#
+# XXX TODO add argument to get paths to chip processed images
+
+use warnings;
+use strict;
+
+use vars qw( $VERSION );
+$VERSION = '0.01';
+
+use DBI;
+use IPC::Cmd 0.36 qw( can_run run );
+use PS::IPP::Metadata::Config;
+
+use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
+use Pod::Usage qw( pod2usage );
+
+use PS::IPP::Config qw(
+    $PS_EXIT_SUCCESS
+    $PS_EXIT_UNKNOWN_ERROR
+    $PS_EXIT_SYS_ERROR
+    $PS_EXIT_CONFIG_ERROR
+    $PS_EXIT_PROG_ERROR
+    $PS_EXIT_DATA_ERROR
+    $PS_EXIT_TIMEOUT_ERROR
+    metadataLookupStr
+    );
+
+my ($exp_name, $class_id, $dbname, $verbose);
+
+GetOptions(
+    'exp_name|e=s'  => \$exp_name,
+    'class_id|c=s'  => \$class_id,
+    'dbname|d=s'    => \$dbname, # Database name    
+    'verbose'       => \$verbose,   # Print to stdout
+) or pod2usage( 2 );
+
+pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
+pod2usage( -msg => "Required options: --exp_name",
+	   -exitval => 3) unless
+    defined $exp_name;
+
+if ($class_id) {
+    $class_id = lc($class_id);
+}
+
+# Look for commands we need
+my $missing_tools;
+my $neb_locate = can_run('neb-locate')
+    or (warn "can't find neb-locate" and $missing_tools = 1);
+
+if ($missing_tools) { 
+    warn ("Can't find required tools");
+    exit($PS_EXIT_CONFIG_ERROR); 
+}
+
+my $ipprc = PS::IPP::Config->new();
+my $dbh = getDBHandle();
+
+# Get the list of imfiles
+{
+    # XXX: If there are multiple exposures with the same exposure name
+    # this query will return them all
+    my $query = "SELECT exp_id, class_id, uri FROM rawImfile"
+                . " WHERE exp_name = \'$exp_name\'";
+    if ($class_id) {
+        $query .= " AND class_id = \'$class_id\'";
+    }
+
+    my $stmt = $dbh->prepare($query);
+    $stmt->execute();
+    while (my $ref = $stmt->fetchrow_hashref()) {
+        my $uri = $ref->{uri};
+        my $path;
+        my ($scheme) = $uri =~/^(path|neb|file):/;
+
+        # XXX: I'd like to just use file_resolve but it doesn't currently
+        # work for nebulous paths
+        if (!$scheme) {
+            $path =  $uri;
+        } else {
+            if (lc($scheme) ne "neb") {
+                $path = $ipprc->file_resolve($uri);
+            } else {
+                # use neb-locate
+                my $command = "$neb_locate $uri";
+                my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+                    run(command => $command, verbose => $verbose);
+                unless ($success) {
+                    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+                    warn ("Unable to run $command: $error_code");
+                    exit($error_code);
+                }
+                $path = "@$stdout_buf";
+                chomp $path;
+            }
+        }
+        if ($path) {
+            # remove the leading "file://" if present
+            $path =~ s/^file\:\/\///;
+        }
+        print "$path\n";
+    }
+}
+
+sub getDBHandle {
+    my $dbserver = metadataLookupStr($ipprc->{_siteConfig}, "DBSERVER");
+    my $dbuser = metadataLookupStr($ipprc->{_siteConfig}, "DBUSER");
+    my $dbpassword = metadataLookupStr($ipprc->{_siteConfig}, "DBPASSWORD");
+    if (!$dbname) {
+        $dbname = metadataLookupStr($ipprc->{_siteConfig}, "DBNAME");
+    }
+
+    die "database configuration set up" unless defined($dbserver) and defined($dbuser)
+        and defined($dbpassword) and defined($dbname);
+
+    my $dsn = "DBI:mysql:host=$dbserver;database=$dbname";
+
+    my $dbh = DBI->connect($dsn, $dbuser, $dbpassword) 
+        or die "Cannot connect to database.\n";
+
+    return $dbh;
+}
+
