regexpdir

版本 1.0.0.0 (2.1 KB) 作者: Bob Hamans
Returns a directory listing based on a regular expression
2.1K 次下载
更新时间 2007/9/20

查看许可证

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.

引用格式

Bob Hamans (2024). regexpdir (https://www.mathworks.com/matlabcentral/fileexchange/16216-regexpdir), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2007a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 File Operations 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0

Minor update to incorporate a proper method for persistent variables.