List all and only files with no extension
Mostra commenti meno recenti
How do I list all files in a folder without any extension?
3 Commenti
Bob Thompson
il 20 Nov 2018
How does a file not have an extension? What type of file are you looking at?
Sam Smith
il 20 Nov 2018
Walter Roberson
il 20 Nov 2018
no extension is perfectly valid and common on Unix systems
Risposta accettata
Più risposte (2)
Sam Smith
il 21 Nov 2018
1 Commento
Walter Roberson
il 22 Nov 2018
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
il 20 Nov 2018
0 voti
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
Categorie
Scopri di più su File Operations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!