Code covered by the BSD License  

Highlights from
genpath_exclude

5.0

5.0 | 1 rating Rate this file 7 Downloads (last 30 days) File Size: 2.22 KB File ID: #22209

genpath_exclude

by Jesse Hopkins

 

21 Nov 2008 (Updated 27 Oct 2009)

Executes like genpath, but can ignore specified directories.

| Watch this File

File Information
Description

Executes like genpath, but can ignore directories. Useful to add a directory hierarchy to your path, but ignore CM directories such as "CVS" or ".svn"

Directories may be excluded using regular-expressions as well.

Tested on windows only, but should work on any platform.

Example usage:
genpath_exclude('C:\myDir',{'CVS'}) %<--- simple usage to ignore CVS direcotries

genpath_exclude('C:\myDir',{'\.svn'}) %<--- simple usage to ignore .svn (note that "." must be escaped for proper handling in the regexp)

genpath_exclude('C:\myDir',{'CVS','#.*'}) %<----more advanced usage to ignore CVS directories and any directory starting with "#"

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Recursive addpath
This submission has inspired the following:
deploypcode, deploypcode - recursively pcode files with help attached

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
25 Nov 2008 Thierry Dalon

I think regexp with option 'split' is quite new.=>This may not work with R14 or previous.
For optimization why don't you modify directly genpath to not go into excluded directories?

25 Nov 2008 Jesse Hopkins

Thanks for the comment Thierry. I did look at modifying genpath, and for some reason on my first attempt, the excluded path would still be added, but not the tree beneath it. That is when I went off looking into the regexp business to remove the offending paths.

Taking a second look, I realize that it is possible to modify genpath directly accomplish this goal, which should operate faster since it wouldn't recurse on the ignored directories.

07 Jun 2010 Sebastian

Does what it says on the tin. Excellent subfolder exclusion.

Please login to add a comment or rating.
Updates
25 Nov 2008

Updated file so that it is a modified version of genpath, rather than post-processing the output of genpath.

25 Nov 2008

Made input more robust so that if user enters a string as 'excudeDir' rather than a cell array of strings this function will still work.

11 Dec 2008

Updated description.

27 Oct 2009

fixed regexp handling. wrapped each expression in ^ and $ chars. Added more help comments

Tag Activity for this File
Tag Applied By Date/Time
svn Jesse Hopkins 24 Nov 2008 13:42:59
cvs Jesse Hopkins 24 Nov 2008 13:42:59
path Jesse Hopkins 24 Nov 2008 13:42:59
cm Jesse Hopkins 24 Nov 2008 13:42:59
cvs Linda 06 Apr 2009 12:37:15
cm Linda 06 Apr 2009 12:37:15
path Linda 06 Apr 2009 12:37:16
svn Linda 06 Apr 2009 12:37:17
svn Nicolas GUILLAUME 18 May 2010 11:53:01

Contact us at files@mathworks.com