Lists the files in a directory and its sub directories. function [D] = rdir(ROOT,TEST) Recursive directory listing. ROOT is the directory starting point and includes the wildcard specification. The function returns a structure D similar to the one returned by the built-in dir command. There is one exception, the name field will include the relative path as well as the name to the file that was found. Pathnames and wildcards may be used. Wild cards can exist in the pathname too. A special case is the double * that will match multiple directory levels, e.g. c:\**\*.m. Otherwise a single * will only match one directory level. e.g. C:\Program Files\Windows *\ TEST is an optional test that can be performed on the files. Two variables are supported, datenum & bytes. Tests are strings similar to what one would use in a if statement. e.g. 'bytes>1024 & datenum>now-7' If not output variables are specified then the output is sent to the screen. See also DIR examples: D = rdir('*.m'); for ii=1:length(D), disp(D(ii).name); end; % to find all files in the current directory and sub directories D = rdir('**\*') % If no output is specified then the files are sent to % the screen. rdir('c:\program files\windows *\*.exe'); rdir('c:\program files\windows *\**\*.dll'); % Using the test function to find files modified today rdir('c:\win*\*','datenum>floor(now)'); % Using the test function to find files of a certain size rdir('c:\program files\win*\*.exe','bytes>1024 & bytes<1048576');