Code covered by the BSD License  

Highlights from
regexpdir

5.0

5.0 | 1 rating Rate this file 6 Downloads (last 30 days) File Size: 2.15 KB File ID: #16216

regexpdir

by Bob Hamans

 

03 Sep 2007 (Updated 20 Sep 2007)

Returns a directory listing based on a regular expression

| Watch this File

File Information
Description

REGEXPDIR Gives a directory listing based on a regular expression REGEXPDIR(ROOTDIR, REGEXP) gives a directory listing of the directory ROOTDIR based on the pattern specified by the regular expression REGEXP.

REGEXPDIR(ROOTDIR, REGEXP, RECURSIVE) By default REGEXPDIR traverses all subdirectories recursively. This behaviour can be controlled by supplying the optional boolean RECURSIVE. Setting this to 'false' will limit the function to the directory specified in ROOTDIR.

Example:
 rootdir = 'C:\';
 expstr = '^.*\.exe$';
 dirlist = regexpdir(rootdir, expstr);

The above example will return any EXE files on the C-drive.

By default REGEXPDIR searches case insensitive. To make it case senstitive please specify it in the regular expression by adding '(?-i)' to it. Ommitting to specify the beginning '^' and ending '$' of the regular expression may result in unexpected behaviour.

Have a look at the source code for more information. For more info on this function and how to use it, bug reports, feature requests, etc. feel free to contact the author.

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
17 Dec 2007 Felix Biessmann  
Please login to add a comment or rating.
Updates
20 Sep 2007

Minor update to incorporate a proper method for persistent variables.

Tag Activity for this File
Tag Applied By Date/Time
path Bob Hamans 22 Oct 2008 09:25:31
directories Bob Hamans 22 Oct 2008 09:25:31
files Bob Hamans 22 Oct 2008 09:25:31
dir Bob Hamans 22 Oct 2008 09:25:31
search Bob Hamans 22 Oct 2008 09:25:31
recursive Bob Hamans 22 Oct 2008 09:25:31
regular expression Bob Hamans 22 Oct 2008 09:25:31
regexp Bob Hamans 29 Jan 2009 11:15:42

Contact us at files@mathworks.com