zhichaoma

找到根目录下所有的以test开头的文件并把查找结果当做参数传给rm -rf命令进行删除: 
1、find / -name “test*” |xargs rm -rf 
2、find / -name “test*” -exec rm -rf {} \; 
3、rm -rf $(find / -name “test”)

如果想指定递归深度,可以这样: 
1、find / -maxdepth 3 -name “*.mp3” |xargs rm -rf 
2、find / -maxdepth 3 -name “test*” -exec rm -rf {} \; 
3、rm -rf $(find / -maxdepth 3 -name “test”) 
这样只会查找三层目录中符合条件的文件并删除掉! 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-10-09
  • 2022-12-23
  • 2022-01-20
  • 2021-07-07
  • 2022-12-23
  • 2022-02-09
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-06
  • 2022-12-23
相关资源
相似解决方案