diff --git a/doc/manual/source/dynare-misc-commands.rst b/doc/manual/source/dynare-misc-commands.rst
index c7abd2e7e18c029362c0eadb7da9e4f126c3b56d..3cee5859c18b7101167b9c600dd3a39bfc2a5e6e 100644
--- a/doc/manual/source/dynare-misc-commands.rst
+++ b/doc/manual/source/dynare-misc-commands.rst
@@ -22,6 +22,12 @@ Dynare misc commands
 
     Puts the IRFs stored in ``oo_.irfs`` into vectors with the same name into the base workspace.
 
+.. matcomm:: clean_current_folder ;
+
+    Cleans the current folder from all files generated by Dynare for the mod-files currently located in
+    the current folder. It will delete all class files (+folders), log-files, and folders generated by 
+    previous runs of these files. Note that this also applies the results subfolder. Proceed with caution.
+
 .. command:: prior_function(OPTIONS);
 
     Executes a user-defined function on parameter draws from the prior
diff --git a/matlab/utilities/general/clean_current_folder.m b/matlab/utilities/general/clean_current_folder.m
index f458d6a641a1cc8459e31923ab2e80164f8ab242..4ea10a4bf94d370964625fd5c2d784daa4e765a2 100644
--- a/matlab/utilities/general/clean_current_folder.m
+++ b/matlab/utilities/general/clean_current_folder.m
@@ -1,6 +1,6 @@
 function clean_current_folder()
 
-% Copyright © 2014-2017 Dynare Team
+% Copyright © 2014-2024 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -22,20 +22,20 @@ a = dir('*.mod');
 
 for i = 1:length(a)
     [~,basename] = fileparts(a(i).name);
-    if exist([basename '.m'])
-        delete([basename '.m']);
-    end
-    if exist([basename '.log'])
+    if isfile([basename '.log'])
         delete([basename '.log']);
     end
-    if exist(basename,'dir')
+    if isfolder(basename)
         rmdir(basename,'s');
     end
-    if exist([basename '_steadystate.m'])
+    if isfolder(['+',basename])
+        [~,~]=rmdir(['+', basename],'s');
+    end
+    if isfile([basename '_steadystate.m'])
         movefile([basename '_steadystate.m'],['protect_' basename '_steadystate.m']);
     end
     delete([basename '_*'])
-    if exist(['protect_' basename '_steadystate.m'])
+    if isfile(['protect_' basename '_steadystate.m'])
         movefile(['protect_' basename '_steadystate.m'],[basename '_steadystate.m']);
     end
 end