查找包含字符串“skull”的目錄、在找出的路徑中找出格式“.c/.cpp/.h”的文件、並統計出數量
find . -path ./out -prune -o -iname "skull" -print | xargs -I % find % -iname *.[c,cpp,h] | wc -l
命令分拆解析
查找包含字符串“skull”的目錄,且排除在/out路徑下查找
find . -path ./out -prune -o -iname "skull" -print
排除多個目錄
find . \( -path ./out -o -path ./vendor \) -prune -o -iname "skull" -print
查找包含字符串“skull”的目錄、並統計出文件和文件夾數量
find . -path ./out -prune -o -iname "skull" -print | xargs -I % ls -lR % | grep "^-" | wc -l
find . -path ./out -prune -o -iname "skull" -print | xargs -I % ls -lR % | grep "^d" | wc -l