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

后端 未结 20 1515
迷失自我
迷失自我 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条回答
  •  猫巷女王i
    2020-12-04 05:40

    In a source code repository, I generally want to do things only to the text files.

    The first line is all files, excluding CVS, SVN, and GIT repository files.

    The second line excludes all binary files.

    find . -not \( -name .svn -prune -o -name .git -prune -o -name CVS -prune \) -type f -print0 | \
    xargs -0 file -n | grep -v binary | cut -d ":" -f1
    

提交回复
热议问题