Code covered by the BSD License  

Highlights from
Recursive Directory Function Execution

Be the first to rate this file! 1 Download (last 30 days) File Size: 1.62 KB File ID: #20814

Recursive Directory Function Execution

by Rodney Thomson

 

22 Jul 2008 (Updated 22 Jul 2008)

Recurse through all directories executing the supplied function

| Watch this File

File Information
Description

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);

MATLAB release MATLAB 7.0.4 (R14SP2)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
30 Jul 2008 Thierry Dalon

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

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
path Rodney Thomson 22 Oct 2008 10:11:15
directories Rodney Thomson 22 Oct 2008 10:11:15
files Rodney Thomson 22 Oct 2008 10:11:15
recursion Rodney Thomson 22 Oct 2008 10:11:15
function handle Rodney Thomson 22 Oct 2008 10:11:15
recurse Rodney Thomson 22 Oct 2008 10:11:15
utilities Rodney Thomson 22 Oct 2008 10:11:15
function handle Linda 06 Apr 2009 12:38:23
recurse Linda 06 Apr 2009 12:38:24
recursion Linda 06 Apr 2009 12:38:25
utilities Linda 06 Apr 2009 12:38:27
files Linda 06 Apr 2009 12:38:28
directories Linda 06 Apr 2009 12:38:29

Contact us at files@mathworks.com