diff --git a/harvest/batch-delete.bat b/harvest/batch-delete.bat
index d73276833546d80a63902b6fa2e93b8af6de9bc0..318807bd2237b80528ce6a427a6acda8b5cbdd69 100644
--- a/harvest/batch-delete.bat
+++ b/harvest/batch-delete.bat
@@ -58,10 +58,17 @@ md %BASEPATH%\processed
 
 rem Process all the files in the target directory:
 cd %VUFIND_HOME%\util
+set FOUNDSOME=0
 for %%a in (%BASEPATH%\*.delete) do (
+  set FOUNDSOME=1
   echo Processing %%a...
   php deletes.php %%a flat %2
   move %%a %BASEPATH%\processed\ > nul
 )
 
+if "%FOUNDSOME%"=="0" goto end
+
+echo Optimizing index...
+php optimize.php
+
 :end
\ No newline at end of file
diff --git a/harvest/batch-delete.sh b/harvest/batch-delete.sh
index d0f14464c4b1ff342c59904a80c0be0b0c4c62cf..a913293f54ebb301b696063fcf85c97b1f64d8fe 100755
--- a/harvest/batch-delete.sh
+++ b/harvest/batch-delete.sh
@@ -44,13 +44,21 @@ then
 fi
 
 # Process all the files in the target directory:
+FOUNDSOME=0
 cd $VUFIND_HOME/util
 for file in $BASEPATH/*.delete
 do
   if [ -f $file ]
   then
+    FOUNDSOME=1
     echo "Processing $file ..."
     php deletes.php $file flat $2
     mv $file $BASEPATH/processed/`basename $file`
   fi
 done
+
+if [ "$FOUNDSOME" -eq "1" ]
+then
+  echo "Optimizing index..."
+  php optimize.php
+fi
\ No newline at end of file
diff --git a/module/VuFindConsole/src/VuFindConsole/Controller/UtilController.php b/module/VuFindConsole/src/VuFindConsole/Controller/UtilController.php
index 0a16b88a7dadcf6f268094485c7cf85352881c21..253a031af6b983ab39f47e9e42f09988a508ed44 100644
--- a/module/VuFindConsole/src/VuFindConsole/Controller/UtilController.php
+++ b/module/VuFindConsole/src/VuFindConsole/Controller/UtilController.php
@@ -296,8 +296,6 @@ class UtilController extends AbstractBase
         // Delete, Commit and Optimize if necessary:
         if (!empty($ids)) {
             $solr->deleteRecords($ids);
-            $solr->commit();
-            $solr->optimize();
         }
         return $this->getSuccessResponse();
     }