Linux find xargs rm .orig

/*********************************************************************
 *                    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

 

posted on 2016-04-25 10:23  zengjf  阅读(622)  评论(0编辑  收藏  举报

导航