find all files except e.g. *.xml files in shell

前端 未结 6 1772
天命终不由人
天命终不由人 2021-01-04 07:09

Using bash, how to find files in a directory structure except for *.xml files? I\'m just trying to use

find . -regex ....

regexe:

6条回答
  •  [愿得一人]
    2021-01-04 07:35

    Sloppier than the find solutions above, and it does more work than it needs to, but you could do

    find . | grep -v '\.xml$'
    

    Also, is this a tree of source code? Maybe you have all your source code and some XML in a tree, but you want to only get the source code? If you were using ack, you could do:

    ack -f --noxml
    

提交回复
热议问题