File Exchange

image thumbnail

Recursive Directory Function Execution

version 1.0 (1.62 KB) by

Recurse through all directories executing the supplied function

0 Downloads

Updated

View License

Recurses through each directory, passing the full directory path and any extraneous arguments (varargin) to the specified function.

Call Sequence : directoryRecurse(directory, function_pointer, varargin)

IE: To execute the 'rmdir' command with the 's' parameter over 'c:\tmp' and all subdirectories:

directoryRecurse('c:\tmp', @rmdir, 's');

Another useful example, add 'c:\matlab' and all sub directories to the Matlab path:
directoryRecurse('c:\tmp', @addpath);

Comments and Ratings (1)

Thierry Dalon

Idea is good but no concatenated output like in filefun FX9723.
only interesting for functions with no output.

MATLAB Release
MATLAB 7.0.4 (R14SP2)

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

» Watch video

Win prizes and improve your MATLAB skills

Play today