Index: trunk/ippScripts/scripts/detrend_process_exp.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_process_exp.pl	(revision 11297)
+++ trunk/ippScripts/scripts/detrend_process_exp.pl	(revision 11298)
@@ -19,5 +19,5 @@
 use Pod::Usage qw( pod2usage );
 
-my ($det_id, $exp_tag, $camera, $dbname, $no_update);
+my ($det_id, $exp_tag, $camera, $dbname, $workdir, $no_update);
 GetOptions(
     'det_id|d=s'        => \$det_id,
@@ -25,4 +25,5 @@
     'camera|c=s'        => \$camera,
     'dbname|d=s'        => \$dbname, # Database name
+    'workdir|w=s'       => \$workdir,	# Working directory, for output files
     'no-update'         => \$no_update
 ) or pod2usage( 2 );
@@ -90,10 +91,13 @@
 }
 
-my $example = ${$files}[0]->{b1_uri}; # Example filename
-my ($vol, $dir, $file) = File::Spec->splitpath( $example );
+unless (defined $workdir) {
+    my $example = ${$files}[0]->{b1_uri}; # Example filename
+    my ($vol, $dir, $file) = File::Spec->splitpath( $example );
+    $workdir = $dir;
+}
 
 # Generate the file list, and get the statistics
 my $outputRoot = $exp_tag . '.detproc.' . $det_id; # Root output name
-$outputRoot = File::Spec->catpath( $vol, $dir, $outputRoot );
+$outputRoot = File::Spec->catfile( $workdir, $outputRoot );
 $outputRoot = $ipprc->convert_filename_absolute($outputRoot);
 my $list1Name = $outputRoot . '.b1.list'; # Name for the input file list for binning 1
