lsr

ls with regexp
417.0 次下载
更新时间 2017/8/10

查看许可证

wrapper for ls, which lists the files in one or more folders
patterns can use combinatorial logic (and, or, not, etc)
patterns can use regexp or ls syntax
output can be a structure (ala ls), or a cell array of filenames.
examples:
list all files with extensions txt and m
[textfiles,mfiles] = lsr('*.txt','*.m');
m-files starting with A or B, names only (two examples)
foo = lsr('A* or B* and *.m','-name')
foo = lsr('^[A|B].*\.m$','-name')
txt files larger than 1MB and all mat files
foo = lsr('size>1mb and txt or mat')

引用格式

Christopher Pedersen (2025). lsr (https://ww2.mathworks.cn/matlabcentral/fileexchange/46047-lsr), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2014a
兼容任何版本
平台兼容性
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.4.0.0

changed recursion of subfolders to use fileattrib instead of genpath
added -nomacfile to supress automatic use of -macfile option on mac OS systems

1.3.0.0

New warnings when receiving patterns that might be ambiguous.
New output option to return patterns
Fixed recursion of subfolders under windows
Added a warning when trying to use a range of matches (e.g. \d{1,3} to catch 1-3 digits), as this does not parse properly in lsr.

1.2.0.0

fixed bug where using -root and -path option together caused filenames to start with / or \

1.1.0.0

changed -root to be an optional output
help updated for clarification.

1.0.0.0