问题描述
我正在尝试构建我的etags文件.我有一个项目结构,以便在给定根目录的情况下有子目录,并且在这些子目录中可以有名为"cpp"的目录.例如:
I am trying to construct my etags file. I have a project structure such that given a root directory there are subdirectories and within those can be directories named 'cpp'. For example:
root
- sub1
- cpp
- sub2
- sub21
- cpp
- csharp
所以对于常规项目,我通常是这样的:找 . -type f(-iname' .cpp'-o -iname' .hpp'-o -iname' .c'-o -iname' .h'-o -iname' .cc'-o -iname' .hh')-print | xargs etags -a
So for regular project i usually something like:find . -type f ( -iname '.cpp' -o -iname '.hpp' -o -iname '.c' -o -iname '.h' -o -iname '.cc' -o -iname '.hh' ) -print | xargs etags -a
这将不再起作用,因为它还会拾取可能是csharp,目标c等的文件...
This won't work anymore as it will also pick up files that could be csharp, objective c etc...
所以我要完成的工作是只找到返回名为cpp的子目录中的文件.那么我如何找到做到这一点的呢?
So what i am trying to accomplish is to only have find return the files in the subdirectories called cpp. So how can i get find to do that?
谢谢...
推荐答案
嵌套find
可能对您有用
find . -type d -name "cpp" -exec find {} -type f \;
这篇关于使用查找,但仅在与某些模式匹配的子目录中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!