假设这个目录是/root,里面有file1,file2,file3..file10  十个文件
[root@oldboy xx]# touch file{1..10}
[root@oldboy xx]# ls
file1  file10  file2  file3  file4  file5  file6  file7  file8  file9
 
方法一:find
[root@oldboy xx]# ls
file1  file10  file2  file3  file4  file5  file6  file7  file8  file9
[root@oldboy xx]# find /root -type f ! -name "file10"|xargs rm -f 
[root@oldboy xx]# ls
file10
 find . file* -exec rm -rf {} \;  还得通过通配符删除之
[root@oldboy xx]# find /root -type f ! -name "file10" -exec rm -f {} \;     
[root@oldboy xx]# ls
file10
 
这两种一个通过xargs传参,一个通过find的-exec执行命令参数来完成,都算作find