From c7f688249d3c21e9e861ecf5262a96187dbde964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?= Date: Wed, 3 Jul 2013 17:03:00 +0200 Subject: [PATCH] Added new routine that returns all the files available in a folder and its subfolders. --- .../tests/get_directory_description.m | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 matlab/utilities/tests/get_directory_description.m diff --git a/matlab/utilities/tests/get_directory_description.m b/matlab/utilities/tests/get_directory_description.m new file mode 100644 index 000000000..790cde771 --- /dev/null +++ b/matlab/utilities/tests/get_directory_description.m @@ -0,0 +1,33 @@ +function files = get_directory_description(basedir) + +% Copyright (C) 2013 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 . + +dd = dir(basedir); +filelist = {}; +file = 1; + +for f=1:length(dd) + if ~(isequal(dd(f).name,'.') || isequal(dd(f).name,'..')) + if dd(f).isdir + filelist(file) = { get_directory_description([ basedir filesep dd(f).name]) }; + else + filelist(file) = { [basedir filesep dd(f).name] }; + end + file = file + 1; + end +end \ No newline at end of file