How to exclude a directory in find . command

后端 未结 30 1364
醉酒成梦
醉酒成梦 2020-11-22 03:36

I\'m trying to run a find command for all JavaScript files, but how do I exclude a specific directory?

Here is the find code we\'re using.<

30条回答
  •  盖世英雄少女心
    2020-11-22 04:08

    This is the format I used to exclude some paths:

    $ find ./ -type f -name "pattern" ! -path "excluded path" ! -path "excluded path"
    

    I used this to find all files not in ".*" paths:

    $ find ./ -type f -name "*" ! -path "./.*" ! -path "./*/.*"
    

提交回复
热议问题