Improved file hounding

Search any file in current directory and subdirectories according to specified criteria
1.3K 次下载
更新时间 2008/9/2

无许可证

% filename : filehound.m
%==========================================================================
% syntax:
% filelist = filehound(filespec)
% or: filelist = filehound
% for default search for *.m files
%
% description : recursively examines directories for presence of files
% matching the filter defined by input parameter 'filespec'
%
% parameters in : filespec = (optional) filter for filenames default = '*.m'
% filespec can be of any kind: a wild card can be used both for filename
% and for extension.
%
% Examples:
% filelist = filehound('*')
% filelist = filehound('*.*')
%
% Search for all files in current directory and subdirectories
%
% filelist = filehound('myfile')
% filelist = filehound('myfile.*')
%
% Search for all files whose name is 'myfile' independently from extension
%
% filelist = filehound('*.ext')
%
% Search for files with specific extension 'ext'
%
% Search of file is powered also by wild-card handling (i.e.: '*'). The
% only assumption is that the current program assumes that '*' is at least
% a permitted char, i.e. '*' cannot be an empty string. In this way: 'ab*c'
% cannot be equivalent to 'abc' in the search. Moreover '*abc' refers to
% the last part of a string, 'ab*c' sets constraints on first two letters
% of the string and the last letter, 'abc*', requires that the first three
% letters of the string are 'abc'. The string here is meant both filename
% and extension. Hence possible calls of filehound can be:
%
% filelist = filehound('*x.m*t')
% filelist = filehound('a*x.mt*')
% filelist = filehound('ax*.*mt')
% ...
% ...
% and all the other possbile combinations. Only one wild-card for filename
% and extension is allowed.
%
% parameters out: filelist = cell array with paths for specified files
%
% NOTE: the code is not optimized - hence suggestions for further improvement are welcomed.

引用格式

Maurizio De Pitta' (2024). Improved file hounding (https://www.mathworks.com/matlabcentral/fileexchange/20597-improved-file-hounding), MATLAB Central File Exchange. 检索来源 .

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

参考作品: filehound

Community Treasure Hunt

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

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

Suggestion by Thierry Dalon has been followed. the file now adopts 'filesep' and it should be bug free. Length of code is remarkably shortened and global variables have been reduced accordingly.