find /dir/ -type f -not -name '匹配模式' -print0 | xargs -0 -I {} rm [选项] {}
想要删除 ~/source 目录下除 php 以外的文件,键入:
find ~/sources/ -type f -not -name '*.php' -delete
或者
find ~/sources/ -type f -not -name '*.php' -print0 | xargs -0 -I {} rm -v {}
只保留 *.zip 和 *.iso 文件的语法如下:
find . -type f -not ( -name '*zip' -or -name '*iso' ) -delete










