How can I get `find` to ignore .svn directories?

后端 未结 20 1483
迷失自我
迷失自我 2020-12-04 05:05

I often use the find command to search through source code, delete files, whatever. Annoyingly, because Subversion stores duplicates of each file in its .

20条回答
  •  既然无缘
    2020-12-04 05:29

    If you tell find to search through '*', then it will skip all "dot files" in the root:

    find *
    

    or with path

    find /path/*
    

    This is not an exact / perfect solution to the question. However, few solutions are simpler than this one. Performance is great too, since it doesn't even enter the hidden directories.

    shortcomings:

    • it doesn't handle nested "dot files".
    • all "dot files" are ignored, not just ".git" and ".svn".

    So in your example adding a star is the only modification you would need:

    find * -name 'messages.*' -exec grep -Iw uint {} +
    

提交回复
热议问题