Index: trunk/ippScripts/scripts/receive_file.pl
===================================================================
--- trunk/ippScripts/scripts/receive_file.pl	(revision 23890)
+++ trunk/ippScripts/scripts/receive_file.pl	(revision 23894)
@@ -65,5 +65,5 @@
 my $filename = "$tempdir/$file";  # Target filename
 {
-    my $uri = "$source/product/$fileset/$file"; # URI for datastore file
+    my $uri = "$source/$product/$fileset/$file"; # URI for datastore file
     my $command = "dsget --uri $uri --filename $filename"; # Command to execute
 
@@ -81,4 +81,5 @@
 
     my $command = "$tool -importrun -infile $filename"; # Command to execute
+    $command .= " -dbname $dbname" if defined $dbname;
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
         run(command => $command, verbose => $verbose);
@@ -88,10 +89,11 @@
     my @files = ();
     {
-        my $command = "tar -C $tempdir -tvzf $filename"; # Command to execute
+        my $command = "tar -C $tempdir -tzf $filename"; # Command to execute
         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
             run(command => $command, verbose => $verbose);
         die "Unable to get listing of tar file $filename\n" unless $success;
 
-        foreach my $line (@$stdout_buf) {
+        my @lines = split(/\n/, join "", @$stdout_buf); # Lines from output
+        foreach my $line ( @lines ) {
             $line =~ s/\#.*$//;
             next unless $line =~ /\S+/;
@@ -99,5 +101,5 @@
             my $file = $fields[0];      # Name of file
             $file =~ s|^./||;
-            push @files, $file if defined $file;
+            push @files, $file if $file =~ /\S+/;
         }
     }
@@ -115,5 +117,5 @@
         my $from = "$tempdir/$file"; # Source for file
         my $target = "$workdir/$file"; # Target destination for file
-        my $to = $ipprc->file_prepare( $target ); # Target for move
+        my $to = $ipprc->file_create( $target ); # Target for move
         system("mv $from $to") == 0 or die "Unable to move $file into workdir $workdir: $!\n";
     }
@@ -129,8 +131,11 @@
 {
     my $command = "$receivetool -addresult";
-    $command .= " -file $file_id";
+    $command .= " -file_id $file_id";
     $command .= (" -dtime_copy " . (($mjd_copy - $mjd_start) * 86400));
-    $command .= (" -dtime_extract " . (($mjd_extract - $mjd_start) * 86400));
+    $command .= (" -dtime_extract " . (($mjd_extract - $mjd_copy) * 86400));
     $command .= " -dbname $dbname" if defined $dbname;
+
+
+    print "$command\n";
 
     unless (defined $no_update) {
