Index: trunk/ippScripts/scripts/magic_destreak_cleanup.pl
===================================================================
--- trunk/ippScripts/scripts/magic_destreak_cleanup.pl	(revision 30520)
+++ trunk/ippScripts/scripts/magic_destreak_cleanup.pl	(revision 30630)
@@ -44,5 +44,5 @@
            'magic_ds_id=s'  => \$magic_ds_id,# Magic destreak run identifier
            'camera=s'       => \$camera,     # camera for evaluating file rules
-           'stage=s'        => \$stage,     # camera for evaluating file rules
+           'stage=s'        => \$stage,      # ipp stage for this magicDSRun
            'save-temps'     => \$save_temps, # Save temporary files?
            'dbname=s'       => \$dbname,     # Database name
@@ -160,5 +160,5 @@
         my $backup_path_base = $comp->{backup_path_base};
         my ($bimage, $bmask, $bch_mask, $bweight, $bsources, $bastrom);
-        my ($rimage, $rmask, $rch_mask, $rweight, $rsources, $rastrom);
+#        my ($rimage, $rmask, $rch_mask, $rweight, $rsources, $rastrom);
 
         if ($stage eq "chip") {
@@ -219,5 +219,5 @@
         }
 
-        delete_files($bimage, $bmask, $bweight, $bsources, $bastrom, $bch_mask, $rch_mask);
+        delete_files($bimage, $bmask, $bweight, $bsources, $bastrom, $bch_mask);
 
         if ($stage eq "diff" and $warp_warp) {
@@ -252,14 +252,6 @@
     foreach my $file (@_) {
         if ($file) {
-            if ($ipprc->file_exists($file)) {
-                if (!$no_update) {
-                    print STDERR "deleting $file\n" if $verbose;
-                    $ipprc->file_delete($file, 1) or my_die("Failed to delete $file", $magic_ds_id, $PS_EXIT_UNKNOWN_ERROR);
-                    } else {
-                    print STDERR "skipping delete $file\n";
-                }
-            } else {
-                print STDERR "$file not found\n" if $verbose;
-            }
+            my $error_code = $ipprc->kill_file($file);
+            my_die("Failed to delete $file", $magic_ds_id, $error_code) if $error_code;
         }
     }
