方法1.
ls|grep -v 'filename'|xargs rm -rf
如果要删除隐藏文件 ls -a
方法2.
打开extglob模式 可以支持正则表达式
shopt -s extglob
rm -rf !(test)