您的位置:首页 > 运维架构 > Linux

Linux find xargs rm .orig

2016-04-25 10:23 519 查看
/*********************************************************************
*                    Linux find xargs rm .orig
* 声明:
*     本文主要是记录在用patch给系统打补丁时,补丁的源文件保存在.orig
* 文件中,尤其是当打补丁失败时,该文件是会生成的,在操作完成之后,我们
* 当然会希望自动将.orig文件删除。
*
*                                  2016-4-25 深圳 南山平山村 曾剑锋
********************************************************************/

一、参考文档:
1. Shell Scripting: Using bash with xargs http://stackoverflow.com/questions/1590297/shell-scripting-using-bash-with-xargs 2. How to delete directories based on `find` output? http://unix.stackexchange.com/questions/89925/how-to-delete-directories-based-on-find-output 
二、操作方法:
1. find * -iname *\.orig | xargs rm
2. find . -name ".orig" -exec rm -r "{}" \;
3. find . -name *\.orig -delete
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: