我想在一个目录中找到所有的php和js文件,并排除子目录之一。
将来我可能不得不排除多个子目录。

我试过了 :

find /home/jul/here -type f -iname "*.php" -o -iname "*.js" ! -path "/home/jul/here/exclude/*"


问题是它仅从/ home / jul / here / exclude中排除了js文件。

有没有办法放一些括号?

找到(某物或其他)并排除此

最佳答案

find /home/jul/here -type f \( -iname "*.php" -o -iname "*.js" \) ! -path "/home/jul/here/exclude/*"

关于linux - find命令如何组合OR和AND,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24003686/

10-13 07:41