Matching all files without an extension, excluding folders [Minimatch]

795 views Asked by At

Using minimatch I can get all the files with the following pattern !*.* but it also matches folder and no longer matches correctly within folders.

I'm testing the patterns here => http://pthrasher.github.io/minimatch-test/

With the following data

404
404.html
index
index.html
apples/
apples/a
apples/a.html
apples/b
apples/b.html
oranges/
oranges/c
oranges/c.html
oranges/d
oranges/d.html

Expected outcome would be

404
index
apples/a
apples/b
oranges/c
oranges/d
1

There are 1 answers

0
alanionita On BEST ANSWER

My current solution was to use a few patterns:

  • one for the "index"
  • one for the "404"
  • one for any files without extensions within folders "*/!(*.*)"