AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
## 使用Linux命令删除一个目录下的所有文件,但保留一个指定文件 ~~~ [root@localhost test]# touch {1..10} [root@localhost test]# ls 1 10 2 3 4 5 6 7 8 9 [root@localhost test]# find -type f ! -name '5' |xargs rm -f # 删除全部但不包括5 [root@localhost test]# ls -l 总计 0 -rw-r--r-- 1 root root 0 09-15 15:42 5 ~~~ ~~~ [root@localhost test]# touch {1..10} [root@localhost test]# ls 1 10 2 3 4 5 6 7 8 9 [root@localhost test]# find -type f ! -name '5' -exec rm -f {} \; # 删除全部但不包括5 [root@localhost test]# ls 5 ~~~