Chinaunix首页 | 论坛 | 博客
  • 博客访问: 421254
  • 博文数量: 86
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 822
  • 用 户 组: 普通用户
  • 注册时间: 2012-12-25 10:36
文章分类

全部博文(86)

文章存档

2022年(1)

2021年(3)

2020年(1)

2019年(9)

2018年(24)

2017年(20)

2016年(20)

2015年(8)

我的朋友

分类: LINUX

2016-10-31 10:47:41

find ./ -type l -exec rm -f {} \;

Find can execute arguments with the -exec option for each match it finds. It is a recommended mechanism because you can handle paths with spaces/newlines and other characters in them correctly. You will have to delete the contents of the directory before you can remove the directory itself, so use -r with the rm command to achieve this.

delete all .svn:
find . -name ".svn" -exec rm -r "{}" \;

You can also tell find to just find directories named .svn by adding a -type d check:
find . -name ".svn" -type d -exec rm -r "{}" \;

Warning Use rm -r with caution it deletes the folder and all its contents.
If you want to delete just empty directories as well as directories that contain only empty directories, find can do that itself with -delete and -empty:
find . -name ".svn" -type d -empty -delete


find ./ -name \* -type f -print | xargs grep "connect_to_service"
阅读(937) | 评论(0) | 转发(0) |
0

上一篇:服务器CPU

下一篇:LINUX内核内存屏障

给主人留下些什么吧!~~