How to exclude a directory in find . command

后端 未结 30 1406
醉酒成梦
醉酒成梦 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:02

    None of previous answers is good on Ubuntu. Try this:

    find . ! -path "*/test/*" -type f -name "*.js" ! -name "*-min-*" ! -name "*console*"
    

    I have found this here

提交回复
热议问题