# 在当前目录下排除abc目录,查找所有文件
find . -path "./abc" -prune -o -print
# 在当前目录下排除abc目录,查找所有以.txt结尾的文件【方式一】
find . -path "./abc" -prune -o -name "*.txt" -print
# 在当前目录下排除abc目录,查找所有以.txt结尾的文件【方式二】
find . -name "*.txt" -not -path "./abc/*"
# 在当前目录下排除abc和def目录,查找所有以.txt结尾的文件
find . \( -path ./abc -o -path ./def \) -prune -o -name "*.txt" -print
# 在当前目录下排除abc目录和def/h.txt文件,查找所有以.txt结尾的文件
find . \( -path ./abc -o -path ./def/h.txt \) -prune -o -name "*.txt" -print
# 在当前目录下排除abc目录和def/h.txt文件和jk目录,查找所有以.txt结尾的文件
find . \( -path ./abc -o -path ./def/h.txt -o -path ./jk \) -prune -o -name "*.txt" -print
# 在当前目录下查找所有不是以.html结尾的文件
find . ! -name "*.html" -type f
find命令排除某些目录或文件
于 2022-01-30 16:39:06 首次发布