Linux反选删除文件

 

最简单的方法是

# shopt -s extglob      (打开extglob模式)
# rm -fr !(file1)
 

如果是多个要排除的,可以这样:

# rm -rf !(file1|file2) 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2020-01-18
  • 2021-11-27
  • 2021-06-27
  • 2021-06-24
  • 2021-10-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-23
  • 2021-09-17
  • 2021-08-05
  • 2021-11-15
相关资源
相似解决方案