Unix find: multiple file types

前端 未结 7 986
一生所求
一生所求 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 15:42

    That's what I use.I strongly recommend the "-regextype posix-extended" argument.

    find . -type f -iname "*.log" -o -iname "*.gz" 
    find . -type f \( -name "*.gz" -o -name "*.log" \)
    find . -type f -regex '.*\(\.gz\|\.log\)'
    find . -type f -regextype posix-extended -regex '.*.(log|gz)'
    

提交回复
热议问题