linux删除所有文件除了某文件(反选删除) 最简单的方法 shopt -s extglob 打开extglob模式 rm -fr !(file1) 排除一个 rm -rf !(file1|file2|file3) 排除多个 shopt -u extglob 关闭extglob模式