List all and only files with no extension
이전 댓글 표시
How do I list all files in a folder without any extension?
댓글 수: 3
Bob Thompson
2018년 11월 20일
How does a file not have an extension? What type of file are you looking at?
Sam Smith
2018년 11월 20일
Walter Roberson
2018년 11월 20일
no extension is perfectly valid and common on Unix systems
채택된 답변
추가 답변 (2개)
Sam Smith
2018년 11월 21일
댓글 수: 1
Walter Roberson
2018년 11월 22일
Too many input arguments -- dir only accepts a single input.
If you repair that to
dir(fullfile(foldername, '*.'))
then it will not do the desired task on Mac or Linux systems: on those systems it will only look for names that end in a literal '.', such as the '.' and '..' entries. On Mac and Linux, lack of a file extension is not treated as the pair (basic_name, empty_extension) the way it might be in DOS 3.1 : On Mac and Linux, '.' is just another character other than '.' as the complete component refers to the current directory, '..' as the complete component refers to the parent directory, and convention that files with '.' as a leading character will not be listed by default in directory listings.
Walter Roberson
2018년 11월 20일
0 개 추천
dir() to get the directory content . Extract the file names to a cellstr. cellfun @fileparts with three outputs and uniform 0. cellfun @isempty the third output . The nonzero locations correspond to files with no extension whose full information you can get from the dir you ran
카테고리
도움말 센터 및 File Exchange에서 File Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!