Index: trunk/ippScripts/scripts/receive_file.pl
===================================================================
--- trunk/ippScripts/scripts/receive_file.pl	(revision 29973)
+++ trunk/ippScripts/scripts/receive_file.pl	(revision 30674)
@@ -41,5 +41,5 @@
 
 # Parse the command-line arguments
-my ( $file_id, $source, $product, $fileset, $fileset_id, $file, $component, $bytes, $md5sum, $workdir, $dirinfo_uri, $dbname, $verbose, $no_update, $save_temps );
+my ( $file_id, $source, $product, $fileset, $fileset_id, $file, $component, $bytes, $md5sum, $workdir, $dirinfo_uri, $no_extract, $dbname, $verbose, $no_update, $save_temps );
 
 GetOptions(
@@ -54,4 +54,5 @@
            'md5sum=s'          => \$md5sum, # md5sum for file from data store
            'workdir=s'         => \$workdir, # Working directory for output
+           'no-extract'        => \$no_extract, # Do not extract the tarfiles
            'dirinfo=s'    => \$dirinfo_uri, # file containing the destination directories for this component
            'dbname=s'          => \$dbname,    # Database name
@@ -85,8 +86,26 @@
 my $mdcParser = PS::IPP::Metadata::Config->new;
 
-
+# select a directory for the dirinfo and dbinfo files
+# XXX: perhaps this directory should be set by the script and passed in
+# rather than computed here.
+
+my ($day, $month, $year) = (localtime)[3,4,5];
+my $datestr = sprintf "%04d%02d%02d", $year+1900, $month + 1, $day;
+my $dir_for_info_files = caturi($workdir, $datestr, $fileset);
+
+
+my $is_tarfile = 0;
+if ($file =~ m|.*\.tgz$|) {        # XXX: perhaps get this off of file type ?
+    $is_tarfile = 1;
+}
+
+my $filename;
+if ($is_tarfile and $no_extract) {
+    $filename = "$dir_for_info_files/$file"; 
+} else {
+    $filename = "$tempdir/$file";
+}
 
 # Retrieve file
-my $filename = "$tempdir/$file";  # Target filename
 {
     my $uri = "$source/$product/$fileset/$file"; # URI for datastore file
@@ -107,11 +126,4 @@
 my ($destdir, $components, $dirinfo_lines) = read_dirinfo_file($dirinfo_file_to_read, $file_id);
 
-# select a directory for the dirinfo and dbinfo files
-# XXX: perhaps this directory should be set by the script and passed in
-# rather than computed here.
-
-my ($day, $month, $year) = (localtime)[3,4,5];
-my $datestr = sprintf "%04d%02d%02d", $year+1900, $month + 1, $day;
-my $dir_for_info_files = caturi($workdir, $datestr, $fileset);
 
 # Deal with file
@@ -279,5 +291,5 @@
 
 
-} elsif ($file =~ m|.*\.tgz$|) {        # XXX: perhaps get this off of file type ?
+} elsif ($is_tarfile and !$no_extract) {
     # Get contents of tarball
     my @files = ();
@@ -339,4 +351,6 @@
         }
     }
+} elsif ($is_tarfile and $no_extract) {
+    print "skipping extraction of tarfile $filename\n";
 } else {
     &my_die( "Unrecognised file: $file\n", $file_id, $PS_EXIT_UNKNOWN_ERROR);
