matlab - List files that don't have any extension using command `dir` -
in directory containing files different extensions, e.g. .ext1, .ext2, , (no extension), how can use dircommand list files don't have extension?
the command dir(fullfile('path/to/dir','*.ext1')) list .ext1 files, don't know of option read extension-less files.
try if following fits needs:
allfiles = dir filelist = {allfiles(3:end).name} mask = cellfun(@isempty, regexp( filelist ,'[^\\]*(?=[.][a-za-z]+$)','match')) output = filelist(mask) the regular expression finds filenames have extension , returns empty array if not. therefore cellfun(@isempty, ... ) give desired mask.
Comments
Post a Comment