Zsh: How to generate (glob) filename excepting specific extension?

Viewed 27

I want to ls files that doesn't have extension *.m2ts nor *.mp4.

Of course, I can get BOTH *.m2ts and *.mp4 files via ls *.(m2ts|mp4) . How can I negate this glob?

1 Answers

I found simple solution:

ls -d ^*.(mp4|m2ts)

This worked well. -d option seems to be mandatory.

       -d, --directory
              list directories themselves, not their contents
Related