简体   繁体   中英

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

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM