Index: trunk/ppStack/src/ppStackFinish.c
===================================================================
--- trunk/ppStack/src/ppStackFinish.c	(revision 25847)
+++ trunk/ppStack/src/ppStackFinish.c	(revision 26117)
@@ -4,4 +4,5 @@
 
 #include <stdio.h>
+#include <unistd.h>
 #include <pslib.h>
 #include <psmodules.h>
@@ -20,4 +21,31 @@
     psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSTACK_RECIPE); // ppStack recipe
     psAssert(recipe, "We've thrown an error on this before.");
+
+    bool mdok;                          // Status of MD lookup
+    bool tempDelete = psMetadataLookupBool(&mdok, recipe, "TEMP.DELETE"); // Delete temporary files?
+
+    // Delete temporary images
+    if (tempDelete && options->convolve) {
+        for (int i = 0; i < options->num; i++) {
+            if (options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) {
+                continue;
+            }
+
+            psString imageResolved = pmConfigConvertFilename(options->convImages->data[i],
+                                                             config, false, false);
+            psString maskResolved = pmConfigConvertFilename(options->convMasks->data[i],
+                                                            config, false, false);
+            psString varianceResolved = pmConfigConvertFilename(options->convVariances->data[i],
+                                                                config, false, false);
+            if (unlink(imageResolved) == -1 || unlink(maskResolved) == -1 ||
+                unlink(varianceResolved) == -1) {
+                psWarning("Unable to delete temporary files for image %d", i);
+            }
+            psFree(imageResolved);
+            psFree(maskResolved);
+            psFree(varianceResolved);
+        }
+    }
+
 
     // Statistics on output
@@ -44,5 +72,4 @@
     }
 
-
     // Write out summary statistics
     if (options->stats) {
@@ -61,7 +88,5 @@
     }
 
-
     // Dump configuration
-    bool mdok;                          // Status of MD lookup
     psString dump = psMetadataLookupStr(&mdok, config->arguments, "DUMP_CONFIG"); // File for config
     if (dump) {
