Unix find: multiple file types

前端 未结 7 865
一生所求
一生所求 2020-12-02 15:32

I want to run find -name with multiple file types. Eg.

 find -name *.h,*.cpp

Is this possible?

相关标签:
7条回答
  • 2020-12-02 16:01

    You can also use the -regex utility:

    find -E . -iregex ".*\.(js|jsx|html|htm)"

    Remember that the regex looks at the full absolute path:

    For an explanation of that regex with test cases check out: https://regex101.com/r/oY1vL2/1

    -E(as a flag BEFORE the path) enables extended (modern) regular expressions.

    This is for BSD find (Mac OSX 10.10.5)

    0 讨论(0)
提交回复
热议问题