View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Recursive directory walk with -exec (UNIX type)

1.0 | 1 rating Rate this file 6 Downloads (last 30 days) File Size: 2.25 KB File ID: #22544 Version: 1.2

Recursive directory walk with -exec (UNIX type)



29 Dec 2008 (Updated )

Directory walking with input function handle called with each matching file found.

| Watch this File

File Information

See decription of RDIR (linked in Acknowledgements) for wildcard use.

Calls a function handle for each matching file found.


Recursive directory walk. EXECFUN is a function handle that gets called for each matching file found.The first input argument being the full path of the file, followed by the optional OPTEXECFUNARGS

ROOT is the directory starting point and includes the wildcard specification. 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 *\

EXECFUN is a function handle which takes at least one input argument

OPTEXECFUNARGS are optional input arguments to EXECFUN

    % To create a file list
    rdirExec('c:\program files\windows *\**\*.dll',@callBack,fid)

    %The callBack function has the following signature
    function callBack(varargin)


Recursive Directory Listing inspired this file.

MATLAB release MATLAB 7.7 (R2008b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
26 May 2009 Henry

Henry (view profile)

Great concept, but buggy implementation.

29 Dec 2008 1.1

text indents in desc

10 May 2010 1.2

*Fixed 'clear D' bug

Contact us