2

I'm trying to write a glob pattern that matches all files *.* but not index.html.

I started with: *.*!(index.html), but this doesn't result in the correct output.

I'm reading node-glob documentation.

After looking at this answer

I feel it may not be achievable...?

I don't want to use the exclude option in the glob options, I want to try and do it using the glob pattern alone.

Callum Linington
  • 14,213
  • 12
  • 75
  • 154

1 Answers1

2

This is old I know, but I wanted something similar. The answer is you're misinterpreting the docs: to match all files but not index.html is just !(index.html). You don't need the *.*. So, for example, to match all files in your dist folder and subfolders, but not index.html, would be ./dist/**/!(index.html).

Rich N
  • 8,939
  • 3
  • 26
  • 33