diff --git a/scripts/upgrade b/scripts/upgrade
index fd72d31..2e1cd5a 100755
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -196,12 +196,7 @@ if [ -f "$final_path/data/deleted.files" ]; then
 		# Move to the dokuwiki installation folder so the "official" commands can be used without adaptation
 		cd $final_path
 
-		# This command could not remove directory
-		#grep -Ev '^($|#)' data/deleted.files | xargs -n 1 rm -vf
-		# => "rm: cannot remove 'vendor/easybook/geshi': Is a directory"
-
-		# That one works as expected
-		grep -Ev '^($|#)' data/deleted.files | xargs -n 1 rm -fr
+		grep --extended-regexp --invert-match '^($|#)' data/deleted.files | xargs --max-args=1 rm --force --dir || true
 	)
 fi