我想列出所有的.hpp
文件,但那些路径包含一个词,例如:
find -name '*.hpp'
会给
folder1/folder2/something.hpp
folder1/folder3/something.hpp
folder1/folder4/something.hpp
我想排除的文件夹2中的文件,以只有这些:
folder1/folder3/something.hpp
folder1/folder4/something.hpp
我想列出所有的.hpp
文件,但那些路径包含一个词,例如:
find -name '*.hpp'
会给
folder1/folder2/something.hpp
folder1/folder3/something.hpp
folder1/folder4/something.hpp
我想排除的文件夹2中的文件,以只有这些:
folder1/folder3/something.hpp
folder1/folder4/something.hpp
只是否定一个-path
条件:
find -name '*.hpp' -not -path '*/folder2/*'
要排除多个目录,重复上述条件:
find -name '*.hpp' -not -path '*/folder2/*' -not -path '*/folder3/*'
或正则表达式使用替代:
find -name '*.hpp' -not -regex '.*/\(folder2\|folder3\)/.*'