Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我必须找到一个目录“ Dir1 ”,不包括“ Dir2 ”和“ Dir3 ”,使用命令 find
$ find . -name Dir1 -type d \( -name Dir2 -o -name Dir3 \) \ -prune -o -print
不工作
移到-prune开头:
-prune
find . \( -name Dir2 -o -name Dir3 \) -prune -o -name Dir1 -type d