Exclude a subpath in find command

This question already has an answer here:

  • How to exclude a directory in find . command 32 answers

  • Use -prune to avoid recursing down branches you don't want to follow.

    find /mnt/F_11 -name DONOTENTER -prune -o 
         -type f ( -iname '*.xls' -o -iname '*.xlsx' ) -print
    

    Note the explicit -print at the end -- this is important, as otherwise the implicit print action covers both branches.

    链接地址: http://www.djcxy.com/p/78128.html

    上一篇: 排除搜索整个系统的目录

    下一篇: 在find命令中排除子路径