diff --git a/matlab/estimation/PosteriorIRF.m b/matlab/estimation/PosteriorIRF.m
index d6cf33ea5be1c63cf6d2b153a24958f7536058d9..e5a9861ef7a727c60dacbf60db77bfb3352fa226 100644
--- a/matlab/estimation/PosteriorIRF.m
+++ b/matlab/estimation/PosteriorIRF.m
@@ -25,7 +25,7 @@ function oo_=PosteriorIRF(type,options_,estim_params_,oo_,M_,bayestopt_,dataset_
 % functions associated with it(the _core1 and _core2).
 % See also the comments posterior_sampler.m funtion.
 
-% Copyright © 2006-2023 Dynare Team
+% Copyright © 2006-2024 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -83,12 +83,13 @@ end
 
 DirectoryName = CheckPath('Output',M_.dname);
 if strcmpi(type,'posterior')
-    MhDirectoryName = CheckPath('metropolis',M_.dname);
+    folder_name=get_posterior_folder_name(options_);
+    MhDirectoryName = CheckPath(folder_name,M_.dname);
 elseif strcmpi(type,'gsa')
     if options_.opt_gsa.pprior
-        MhDirectoryName = CheckPath(['GSA' filesep 'prior'],M_.dname);
+        MhDirectoryName = CheckPath(['gsa' filesep 'prior'],M_.dname);
     else
-        MhDirectoryName = CheckPath(['GSA' filesep 'mc'],M_.dname);
+        MhDirectoryName = CheckPath(['gsa' filesep 'mc'],M_.dname);
     end
 else
     MhDirectoryName = CheckPath('prior',M_.dname);
diff --git a/matlab/estimation/ReshapeMatFiles.m b/matlab/estimation/ReshapeMatFiles.m
index 58107602eb15542bb828e7cbb244dc057b818580..a4051bfb416d4b92cc3b0b9832250bf2f13db18c 100644
--- a/matlab/estimation/ReshapeMatFiles.m
+++ b/matlab/estimation/ReshapeMatFiles.m
@@ -30,7 +30,7 @@ function ReshapeMatFiles(fname, dname, exo_nbr, endo_nbr, options_, type, type2)
 % SPECIAL REQUIREMENTS
 %    none
 
-% Copyright © 2003-2023 Dynare Team
+% Copyright © 2003-2024 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -48,10 +48,12 @@ function ReshapeMatFiles(fname, dname, exo_nbr, endo_nbr, options_, type, type2)
 % along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
 
 if nargin==6
-    MhDirectoryName = [ CheckPath('metropolis',dname) filesep ];
+    folder_name=get_posterior_folder_name(options_);
+    MhDirectoryName = [CheckPath(folder_name,dname) filesep ];
 else
     if strcmpi(type2,'posterior')
-        MhDirectoryName = [CheckPath('metropolis',dname) filesep ];
+        folder_name=get_posterior_folder_name(options_);
+        MhDirectoryName = [CheckPath(folder_name,dname) filesep ];
     elseif strcmpi(type2,'gsa')
         if options_.opt_gsa.morris==1
             MhDirectoryName = [CheckPath('gsa/screen',dname) filesep ];
diff --git a/matlab/estimation/check_posterior_analysis_data.m b/matlab/estimation/check_posterior_analysis_data.m
index 90c836afc9b759f5311fcb7ccca5aa34a0f203ab..6de65d2de26ed4380f63f3785b3ddc4dc5f5a467 100644
--- a/matlab/estimation/check_posterior_analysis_data.m
+++ b/matlab/estimation/check_posterior_analysis_data.m
@@ -67,10 +67,10 @@ if isempty(drawsinfo)
     end
     return
 else
-    mhname = get_name_of_the_last_mh_file(M_);
+    number_of_last_posterior_draws_file = length(drawsinfo);
     if ~issmc(options_)
+        mhname = get_name_of_the_last_mh_file(M_);
         mhdate = get_date_of_a_file([MetropolisFolder filesep mhname]);
-        number_of_last_posterior_draws_file = length(drawsinfo);
     else
         if ishssmc(options_)
             % Load draws from the posterior distribution
diff --git a/matlab/estimation/conditional_variance_decomposition_ME_mc_analysis.m b/matlab/estimation/conditional_variance_decomposition_ME_mc_analysis.m
index 6c787b0c80551fd78f1eb2982d5c37d9a7918876..f09dff723fdc1ced3923aad5ed54b3fc9b0a2b80 100644
--- a/matlab/estimation/conditional_variance_decomposition_ME_mc_analysis.m
+++ b/matlab/estimation/conditional_variance_decomposition_ME_mc_analysis.m
@@ -23,7 +23,7 @@ function oo_ = ...
 % OUTPUTS
 %   oo_          [structure]        Dynare structure where the results are saved.
 
-% Copyright © 2017-2023 Dynare Team
+% Copyright © 2017-2024 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -41,8 +41,9 @@ function oo_ = ...
 % along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
 
 if strcmpi(type,'posterior')
+    folder_name=get_posterior_folder_name(options_);
     TYPE = 'Posterior';
-    PATH = [dname '/metropolis/'];
+    PATH = [dname filesep folder_name filesep ];
 else
     TYPE = 'Prior';
     PATH = [dname '/prior/moments/'];
diff --git a/matlab/estimation/conditional_variance_decomposition_mc_analysis.m b/matlab/estimation/conditional_variance_decomposition_mc_analysis.m
index ab4f7e77d88e6082b18af8cd1d545bfbaac52b91..b84a7b64cd9793f8a537d0d1204b36f22b598bf2 100644
--- a/matlab/estimation/conditional_variance_decomposition_mc_analysis.m
+++ b/matlab/estimation/conditional_variance_decomposition_mc_analysis.m
@@ -23,7 +23,7 @@ function oo_ = ...
 % OUTPUTS
 %   oo_          [structure]        Dynare structure where the results are saved.
 
-% Copyright © 2009-2018 Dynare Team
+% Copyright © 2009-2024 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -41,8 +41,9 @@ function oo_ = ...
 % along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
 
 if strcmpi(type,'posterior')
+    folder_name=get_posterior_folder_name(options_);
     TYPE = 'Posterior';
-    PATH = [dname '/metropolis/'];
+    PATH = [dname filesep folder_name filesep];
 else
     TYPE = 'Prior';
     PATH = [dname '/prior/moments/'];
diff --git a/matlab/estimation/correlation_mc_analysis.m b/matlab/estimation/correlation_mc_analysis.m
index 94b10bb74a2626edacdfd48c76715092045eb1c6..d4b8235ec271ccf2f2d4d677ce41486946f2b394 100644
--- a/matlab/estimation/correlation_mc_analysis.m
+++ b/matlab/estimation/correlation_mc_analysis.m
@@ -2,7 +2,7 @@ function oo_ = correlation_mc_analysis(SampleSize,type,dname,fname,vartan,nvar,v
 % This function analyses the (posterior or prior) distribution of the
 % endogenous variables correlation function.
 
-% Copyright © 2008-2017 Dynare Team
+% Copyright © 2008-2024 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -20,8 +20,9 @@ function oo_ = correlation_mc_analysis(SampleSize,type,dname,fname,vartan,nvar,v
 % along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
 
 if strcmpi(type,'posterior')
+    folder_name=get_posterior_folder_name(options_);
     TYPE = 'Posterior';
-    PATH = [dname '/metropolis/'];
+    PATH = [dname filesep folder_name filesep];
 else
     TYPE = 'Prior';
     PATH = [dname '/prior/moments/'];
diff --git a/matlab/estimation/covariance_mc_analysis.m b/matlab/estimation/covariance_mc_analysis.m
index 92b7b451c9b9c7811e8b6e717b21e3bace3b7ae3..d0c4f77f7077392c655e3b28915d17cbb1bc6452 100644
--- a/matlab/estimation/covariance_mc_analysis.m
+++ b/matlab/estimation/covariance_mc_analysis.m
@@ -19,7 +19,7 @@ function oo_ = covariance_mc_analysis(NumberOfSimulations,type,dname,fname,varta
 % OUTPUTS
 %   oo_                     [structure]        Dynare structure where the results are saved.
 
-% Copyright © 2008-2017 Dynare Team
+% Copyright © 2008-2024 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -37,8 +37,9 @@ function oo_ = covariance_mc_analysis(NumberOfSimulations,type,dname,fname,varta
 % along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
 
 if strcmpi(type,'posterior')
+    folder_name=get_posterior_folder_name(options_);
     TYPE = 'Posterior';
-    PATH = [dname '/metropolis/'];
+    PATH = [dname filesep folder_name filesep];
 else
     TYPE = 'Prior';
     PATH = [dname '/prior/moments/'];
diff --git a/matlab/estimation/dsge_simulated_theoretical_conditional_variance_decomposition.m b/matlab/estimation/dsge_simulated_theoretical_conditional_variance_decomposition.m
index 6e052b6ec6c506af9d502c62a11188088b793920..c0ca04a89f01b2f2c5c8f359224856e5b6084334 100644
--- a/matlab/estimation/dsge_simulated_theoretical_conditional_variance_decomposition.m
+++ b/matlab/estimation/dsge_simulated_theoretical_conditional_variance_decomposition.m
@@ -19,7 +19,7 @@ function [nvar,vartan,NumberOfConditionalDecompFiles] = ...
 %   vartan                           [char]     array of characters (with nvar rows).
 %   NumberOfConditionalDecompFiles   [integer]  scalar, number of prior or posterior data files (for covariance).
 
-% Copyright © 2009-2023 Dynare Team
+% Copyright © 2009-2024 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -37,9 +37,11 @@ function [nvar,vartan,NumberOfConditionalDecompFiles] = ...
 % along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
 
 
+folder_name=get_posterior_folder_name(options_);
+
 % Get informations about the _posterior_draws files.
 if strcmpi(type,'posterior')
-    NumberOfDrawsFiles = length(dir([M_.dname '/metropolis/' M_.fname '_' type '_draws*' ]));
+    NumberOfDrawsFiles = length(dir([M_.dname filesep folder_name filesep M_.fname '_' type '_draws*' ]));
     posterior = 1;
 elseif strcmpi(type,'prior')
     NumberOfDrawsFiles = length(dir([M_.dname '/prior/draws/' type '_draws*' ]));
@@ -51,8 +53,8 @@ end
 
 %delete old stale files before creating new ones
 if posterior
-    delete_stale_file([M_.dname '/metropolis/' M_.fname '_PosteriorConditionalVarianceDecomposition*'])
-    delete_stale_file([M_.dname '/metropolis/' M_.fname '_PosteriorConditionalVarianceDecompositionME*'])
+    delete_stale_file([M_.dname filesep folder_name filesep M_.fname '_PosteriorConditionalVarianceDecomposition*'])
+    delete_stale_file([M_.dname filesep folder_name filesep M_.fname '_PosteriorConditionalVarianceDecompositionME*'])
 else
     delete_stale_file([M_.dname '/prior/moments/' M_.fname '_PriorConditionalVarianceDecomposition*'])
     delete_stale_file([M_.dname '/prior/moments/' M_.fname '_PriorConditionalVarianceDecompositionME*'])
@@ -118,7 +120,7 @@ linea = 0;
 linea_ME = 0;
 for file = 1:NumberOfDrawsFiles
     if posterior
-        temp=load([M_.dname '/metropolis/' M_.fname '_' type '_draws' num2str(file) ]);
+        temp=load([M_.dname filesep folder_name filesep M_.fname '_' type '_draws' num2str(file) ]);
     else
         temp=load([M_.dname '/prior/draws/' type '_draws' num2str(file) ]);
     end
@@ -146,7 +148,7 @@ for file = 1:NumberOfDrawsFiles
             ConditionalDecompFileNumber = ConditionalDecompFileNumber + 1;
             linea = 0;
             if posterior
-                save([M_.dname '/metropolis/' M_.fname '_PosteriorConditionalVarianceDecomposition' int2str(ConditionalDecompFileNumber) '.mat' ], ...
+                save([M_.dname filesep folder_name filesep M_.fname '_PosteriorConditionalVarianceDecomposition' int2str(ConditionalDecompFileNumber) '.mat' ], ...
                      'Conditional_decomposition_array','endo_names');
             else
                 save([M_.dname '/prior/moments/' M_.fname '_PriorConditionalVarianceDecomposition' int2str(ConditionalDecompFileNumber) '.mat' ], ...
@@ -167,7 +169,7 @@ for file = 1:NumberOfDrawsFiles
                 ConditionalDecompFileNumber_ME = ConditionalDecompFileNumber_ME + 1;
                 linea_ME = 0;
                 if posterior
-                    save([M_.dname '/metropolis/' M_.fname '_PosteriorConditionalVarianceDecompME' int2str(ConditionalDecompFileNumber_ME) '.mat' ], ...
+                    save([M_.dname filesep folder_name filesep M_.fname '_PosteriorConditionalVarianceDecompME' int2str(ConditionalDecompFileNumber_ME) '.mat' ], ...
                          'Conditional_decomposition_array_ME','endo_names');
                 else
                     save([M_.dname '/prior/moments/' M_.fname '_PriorConditionalVarianceDecompME' int2str(ConditionalDecompFileNumber_ME) '.mat' ], ...
diff --git a/matlab/estimation/dsge_simulated_theoretical_correlation.m b/matlab/estimation/dsge_simulated_theoretical_correlation.m
index d874cb54ba08fc185ebb176db849ec2b86259604..7fa195a2cdc4c1e850df072df660cae0bbca667e 100644
--- a/matlab/estimation/dsge_simulated_theoretical_correlation.m
+++ b/matlab/estimation/dsge_simulated_theoretical_correlation.m
@@ -18,7 +18,7 @@ function [nvar,vartan,CorrFileNumber] = dsge_simulated_theoretical_correlation(S
 %   vartan         [char]           array of characters (with nvar rows).
 %   CorrFileNumber [integer]        scalar, number of prior or posterior data files (for correlation).
 
-% Copyright © 2007-2021 Dynare Team
+% Copyright © 2007-2024 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -38,9 +38,11 @@ function [nvar,vartan,CorrFileNumber] = dsge_simulated_theoretical_correlation(S
 [ivar,vartan] = get_variables_list(options_, M_);
 nvar = length(ivar);
 
+folder_name=get_posterior_folder_name(options_);
+
 % Get informations about the _posterior_draws files.
 if strcmpi(type,'posterior')
-    CorrFileNumber = length(dir([M_.dname '/metropolis/' M_.fname '_PosteriorCorrelations*']));
+    CorrFileNumber = length(dir([M_.dname filesep folder_name filesep M_.fname '_PosteriorCorrelations*']));
 elseif strcmpi(type,'prior')
     CorrFileNumber = length(dir([M_.dname '/prior/moments/' M_.fname '_PriorCorrelations*']));
 else
diff --git a/matlab/estimation/dsge_simulated_theoretical_covariance.m b/matlab/estimation/dsge_simulated_theoretical_covariance.m
index 31d5a1486d1bde18d5a08919e70948af9db42303..cb976ff6844320ba345b7c706eaea28d838ce7da 100644
--- a/matlab/estimation/dsge_simulated_theoretical_covariance.m
+++ b/matlab/estimation/dsge_simulated_theoretical_covariance.m
@@ -16,7 +16,7 @@ function [nvar,vartan,CovarFileNumber] = dsge_simulated_theoretical_covariance(S
 %   vartan            [char]     array of characters (with nvar rows).
 %   CovarFileNumber   [integer]  scalar, number of prior or posterior data files (for covariance).
 
-% Copyright © 2007-2021 Dynare Team
+% Copyright © 2007-2024 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -35,9 +35,11 @@ function [nvar,vartan,CovarFileNumber] = dsge_simulated_theoretical_covariance(S
 
 nodecomposition = 1;
 
+folder_name=get_posterior_folder_name(options_);
+    
 % Get informations about the _posterior_draws files.
 if strcmpi(type,'posterior')
-    NumberOfDrawsFiles = length(dir([M_.dname '/metropolis/' M_.fname '_' type '_draws*' ]));
+    NumberOfDrawsFiles = length(dir([M_.dname filesep folder_name filesep M_.fname '_' type '_draws*' ]));
     posterior = 1;
 elseif strcmpi(type,'prior')
     NumberOfDrawsFiles = length(dir([M_.dname '/prior/draws/' type '_draws*' ]));
@@ -49,8 +51,8 @@ end
 
 %delete old stale files before creating new ones
 if posterior
-    delete_stale_file([M_.dname '/metropolis/' M_.fname '_Posterior2ndOrderMoments*'])
-    delete_stale_file([M_.dname '/metropolis/' M_.fname '_PosteriorCorrelations*']);
+    delete_stale_file([M_.dname filesep folder_name filesep M_.fname '_Posterior2ndOrderMoments*'])
+    delete_stale_file([M_.dname filesep folder_name filesep M_.fname '_PosteriorCorrelations*']);
 else
     delete_stale_file([M_.dname '/prior/moments/' M_.fname '_Prior2ndOrderMoments*'])
     delete_stale_file([M_.dname '/prior/moments/' M_.fname '_PriorCorrelations*']);
@@ -112,7 +114,7 @@ linea_cov = 0;
 linea_corr = 0;
 for file = 1:NumberOfDrawsFiles
     if posterior
-        temp=load([M_.dname '/metropolis/' M_.fname '_' type '_draws' num2str(file) ]);
+        temp=load([M_.dname filesep folder_name filesep M_.fname '_' type '_draws' num2str(file) ]);
     else
         temp=load([M_.dname '/prior/draws/' type '_draws' num2str(file) ]);
     end
@@ -148,7 +150,7 @@ for file = 1:NumberOfDrawsFiles
 
         if linea_cov == NumberOfCovarLines
             if posterior
-                save([ M_.dname '/metropolis/' M_.fname '_Posterior2ndOrderMoments' int2str(CovarFileNumber) '.mat' ],'Covariance_matrix','endo_names');
+                save([ M_.dname filesep folder_name filesep M_.fname '_Posterior2ndOrderMoments' int2str(CovarFileNumber) '.mat' ],'Covariance_matrix','endo_names');
             else
                 save([ M_.dname '/prior/moments/' M_.fname '_Prior2ndOrderMoments' int2str(CovarFileNumber) '.mat' ],'Covariance_matrix','endo_names');
             end
@@ -166,7 +168,7 @@ for file = 1:NumberOfDrawsFiles
         end
         if linea_corr == NumberOfCorrLines
             if posterior
-                save([ M_.dname '/metropolis/' M_.fname '_PosteriorCorrelations' int2str(CorrFileNumber) '.mat' ],'Correlation_array','endo_names');
+                save([ M_.dname filesep folder_name filesep M_.fname '_PosteriorCorrelations' int2str(CorrFileNumber) '.mat' ],'Correlation_array','endo_names');
             else
                 save([ M_.dname '/prior/moments/' M_.fname '_PriorCorrelations' int2str(CorrFileNumber) '.mat' ],'Correlation_array','endo_names');
             end
diff --git a/matlab/estimation/dsge_simulated_theoretical_variance_decomposition.m b/matlab/estimation/dsge_simulated_theoretical_variance_decomposition.m
index 880b27438fd24c358c264befc21dd5e356e41381..209efad68ad577437ea68592a87ebbd1d28581ae 100644
--- a/matlab/estimation/dsge_simulated_theoretical_variance_decomposition.m
+++ b/matlab/estimation/dsge_simulated_theoretical_variance_decomposition.m
@@ -18,7 +18,7 @@ function [nvar,vartan,NumberOfDecompFiles] = ...
 %   vartan            [char]     array of characters (with nvar rows).
 %   CovarFileNumber   [integer]  scalar, number of prior or posterior data files (for covariance).
 
-% Copyright © 2007-2021 Dynare Team
+% Copyright © 2007-2024 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -37,9 +37,11 @@ function [nvar,vartan,NumberOfDecompFiles] = ...
 
 nodecomposition = 0;
 
+folder_name=get_posterior_folder_name(options_);
+
 % Get informations about the _posterior_draws files.
 if strcmpi(type,'posterior')
-    NumberOfDrawsFiles = length(dir([M_.dname '/metropolis/' M_.fname '_' type '_draws*' ]));
+    NumberOfDrawsFiles = length(dir([M_.dname filesep folder_name filesep M_.fname '_' type '_draws*' ]));
     posterior = 1;
 elseif strcmpi(type,'prior')
     NumberOfDrawsFiles = length(dir([M_.dname '/prior/draws/' type '_draws*' ]));
@@ -51,8 +53,8 @@ end
 
 %delete old stale files before creating new ones
 if posterior
-    delete_stale_file([M_.dname '/metropolis/' M_.fname '_PosteriorVarianceDecomposition*']);
-    delete_stale_file([M_.dname '/metropolis/' M_.fname '_PosteriorVarianceDecompME*']);
+    delete_stale_file([M_.dname filesep folder_name filesep M_.fname '_PosteriorVarianceDecomposition*']);
+    delete_stale_file([M_.dname filesep folder_name filesep M_.fname '_PosteriorVarianceDecompME*']);
 else
     delete_stale_file([M_.dname '/prior/moments/' M_.fname '_PriorVarianceDecomposition*']);
     delete_stale_file([M_.dname '/prior/moments/' M_.fname '_PriorVarianceDecompME*']);
@@ -122,7 +124,7 @@ linea_ME = 0;
 only_non_stationary_vars=0;
 for file = 1:NumberOfDrawsFiles
     if posterior
-        temp=load([M_.dname '/metropolis/' M_.fname '_' type '_draws' num2str(file) ]);
+        temp=load([M_.dname filesep folder_name filesep M_.fname '_' type '_draws' num2str(file) ]);
     else
         temp=load([M_.dname '/prior/draws/' type '_draws' num2str(file) ]);
     end
@@ -170,7 +172,7 @@ for file = 1:NumberOfDrawsFiles
         end
         if linea == NumberOfDecompLines
             if posterior
-                save([M_.dname '/metropolis/' M_.fname '_PosteriorVarianceDecomposition' int2str(DecompFileNumber) '.mat' ],'Decomposition_array','endo_names');
+                save([M_.dname filesep folder_name filesep M_.fname '_PosteriorVarianceDecomposition' int2str(DecompFileNumber) '.mat' ],'Decomposition_array','endo_names');
             else
                 save([M_.dname '/prior/moments/' M_.fname '_PriorVarianceDecomposition' int2str(DecompFileNumber) '.mat' ],'Decomposition_array','endo_names');
             end
@@ -189,7 +191,7 @@ for file = 1:NumberOfDrawsFiles
         if ME_present
             if linea_ME == NumberOfDecompLines_ME
                 if posterior
-                    save([M_.dname '/metropolis/' M_.fname '_PosteriorVarianceDecompME' int2str(DecompFileNumber_ME) '.mat' ],'Decomposition_array_ME','endo_names');
+                    save([M_.dname filesep folder_name filesep M_.fname '_PosteriorVarianceDecompME' int2str(DecompFileNumber_ME) '.mat' ],'Decomposition_array_ME','endo_names');
                 else
                     save([M_.dname '/prior/moments/' M_.fname '_PriorVarianceDecompME' int2str(DecompFileNumber_ME) '.mat' ],'Decomposition_array_ME','endo_names');
                 end
diff --git a/matlab/estimation/get_posterior_folder_name.m b/matlab/estimation/get_posterior_folder_name.m
new file mode 100644
index 0000000000000000000000000000000000000000..25b86f1c8b6375b691dfff125cbee03b0752aafd
--- /dev/null
+++ b/matlab/estimation/get_posterior_folder_name.m
@@ -0,0 +1,42 @@
+function folder_name=get_posterior_folder_name(options_)
+% function folder_name=get_posterior_folder_name(options_)
+% runs the estimation of the model
+%
+% INPUTS
+%   options_            [structure] describing the options
+%
+% OUTPUTS
+%   folder_name         [char]      output folder for different posterior
+%                                   samplers
+%
+% SPECIAL REQUIREMENTS
+%   none
+
+% Copyright © 2024 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% Dynare is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
+
+if ~issmc(options_)
+    folder_name='metropolis';
+else
+    if ishssmc(options_)
+        folder_name='hssmc';
+    elseif isdime(options_)
+        folder_name='dime';
+    else
+        error('get_posterior_folder_name:: case should not happen. Please contact the developers')
+    end
+end
\ No newline at end of file
diff --git a/matlab/estimation/prior_posterior_statistics.m b/matlab/estimation/prior_posterior_statistics.m
index 7ff142419183a00f86bae58a5fe04eed88c22427..8b98c63db20096f389e3b5d173ab78f96efdc310 100644
--- a/matlab/estimation/prior_posterior_statistics.m
+++ b/matlab/estimation/prior_posterior_statistics.m
@@ -62,7 +62,8 @@ end
 maxlag = M_.maximum_endo_lag;
 
 if strcmpi(type,'posterior')
-    DirectoryName = CheckPath('metropolis',M_.dname);
+    folder_name=get_posterior_folder_name(options_);
+    DirectoryName = CheckPath(folder_name,M_.dname);
     B = options_.sub_draws;
 elseif strcmpi(type,'gsa')
     RootDirectoryName = CheckPath('gsa',M_.dname);
diff --git a/matlab/estimation/prior_posterior_statistics_core.m b/matlab/estimation/prior_posterior_statistics_core.m
index 65660dabb59324575ac2bbcee33e3d90c0aff31b..5cf8f364e5ff56e0b1de55f0842b981effb04afa 100644
--- a/matlab/estimation/prior_posterior_statistics_core.m
+++ b/matlab/estimation/prior_posterior_statistics_core.m
@@ -119,7 +119,8 @@ end
 
 % DirectoryName = myinputs.DirectoryName;
 if strcmpi(type,'posterior')
-    DirectoryName = CheckPath('metropolis',M_.dname);
+    folder_name=get_posterior_folder_name(options_);
+    DirectoryName = CheckPath(folder_name,M_.dname);
 elseif strcmpi(type,'gsa')
     if options_.opt_gsa.pprior
         DirectoryName = CheckPath(['gsa',filesep,'prior'],M_.dname);
diff --git a/matlab/estimation/selec_posterior_draws.m b/matlab/estimation/selec_posterior_draws.m
index e001e1bc1abf5a54fe2deb6ea0d04ecaeb1d037a..161f8e8e39f284442928c94723c02036e7ebd6c6 100644
--- a/matlab/estimation/selec_posterior_draws.m
+++ b/matlab/estimation/selec_posterior_draws.m
@@ -69,7 +69,7 @@ if ~issmc(options_)
     MetropolisFolder = CheckPath('metropolis',M_.dname);
 else
     if ishssmc(options_)
-        [MetropolisFolder] = CheckPath('metropolis',M_.dname);
+        [MetropolisFolder] = CheckPath('hssmc',M_.dname);
     elseif isdime(options_)
         [MetropolisFolder] = CheckPath('dime',M_.dname);
     else
diff --git a/matlab/estimation/variance_decomposition_ME_mc_analysis.m b/matlab/estimation/variance_decomposition_ME_mc_analysis.m
index 91939d23b351eb9fea52dee2358d0042ad91d28f..22c84544d5aa6b9600333fa432a0e42e39c80974 100644
--- a/matlab/estimation/variance_decomposition_ME_mc_analysis.m
+++ b/matlab/estimation/variance_decomposition_ME_mc_analysis.m
@@ -25,7 +25,7 @@ function oo_ = variance_decomposition_ME_mc_analysis(NumberOfSimulations,type,dn
 
 
 
-% Copyright © 2017 Dynare Team
+% Copyright © 2017-2024 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -43,8 +43,9 @@ function oo_ = variance_decomposition_ME_mc_analysis(NumberOfSimulations,type,dn
 % along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
 
 if strcmpi(type,'posterior')
+    folder_name=get_posterior_folder_name(options_);
     TYPE = 'Posterior';
-    PATH = [dname '/metropolis/'];
+    PATH = [dname filesep folder_name filesep];
 else
     TYPE = 'Prior';
     PATH = [dname '/prior/moments/'];
diff --git a/matlab/estimation/variance_decomposition_mc_analysis.m b/matlab/estimation/variance_decomposition_mc_analysis.m
index d55de6989b1107d026ff453358b2686ccaa46724..a34a507cf50e7359a8024d628d68ccc4bb64eac0 100644
--- a/matlab/estimation/variance_decomposition_mc_analysis.m
+++ b/matlab/estimation/variance_decomposition_mc_analysis.m
@@ -25,7 +25,7 @@ function oo_ = variance_decomposition_mc_analysis(NumberOfSimulations,type,dname
 
 
 
-% Copyright © 2008-2017 Dynare Team
+% Copyright © 2008-2024 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -43,8 +43,9 @@ function oo_ = variance_decomposition_mc_analysis(NumberOfSimulations,type,dname
 % along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
 
 if strcmpi(type,'posterior')
+    folder_name=get_posterior_folder_name(options_);
     TYPE = 'Posterior';
-    PATH = [dname '/metropolis/'];
+    PATH = [dname filesep folder_name filesep];
 else
     TYPE = 'Prior';
     PATH = [dname '/prior/moments/'];