I have a folder with tsx files and test tsx files structured as shown
packages
packageName
src
index.tsx
sample.tsx
sample.test.tsx
tests
index.test.tsx
I have been able to so far write a glob pattern that matches the tsx files that looks like this: packages/**/*.{tsx,ts}
However I would like to exclude the test files in the glob pattern, files that have .test.tsx
, how would I do that
CodePudding user response:
Try
shopt -s globstar extglob
printf '%s\n' packages/**/!(*.test).@(tsx|ts)
See the extglob section in glob - Greg's Wiki.