From 5cec25c69b85543723c1f1861dce2717a8381427 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?William=20L=C3=B6vfors?= <william.lovfors@liu.se>
Date: Fri, 5 Mar 2021 10:02:45 +0100
Subject: [PATCH] added a function that can remove all mex files in the current
 and subfolders.

---
 RemoveAllMEXFiles.m | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 RemoveAllMEXFiles.m

diff --git a/RemoveAllMEXFiles.m b/RemoveAllMEXFiles.m
new file mode 100644
index 0000000..084bcfa
--- /dev/null
+++ b/RemoveAllMEXFiles.m
@@ -0,0 +1,23 @@
+function [] = RemoveAllMEXFiles(ignoreWarning)
+% Removes all mexfiles in current folder and all subfolders
+
+
+files = dir('./**/*.mex*');
+
+if nargin <1 || ~ignoreWarning
+    disp('WARNING!!!!')
+    disp('This will delete ALL files that contains "mex". ')
+    disp('This could potentially remove files from necessary toolboxes.')
+    disp('The following files will be deleted:')
+    for n = 1:length(files)
+        disp([files(n).folder '/' files(n).name])
+    end
+    choice  = input('Do you want to continue? \n(y/n)  ','s');
+end
+if (nargin==1 && ignoreWarning) || strcmp(choice,'y')
+    clear mex
+    for n = 1:length(files)
+        delete([files(n).folder '/' files(n).name])
+    end 
+end
+
-- 
GitLab