码迷,mamicode.com
首页 > 系统相关 > 详细

linux find查找并拷贝 exec xargs区别

时间:2017-02-10 12:44:29      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:使用   find   特殊字符   test   linux   nbsp   linu   命令   字符   

-exec
    1.参数是一个一个传递的,传递一个参数执行一次rm
    2.文件名有空格等特殊字符也能处理
-xargs 
    1.一次将参数传给命令,可以使用-n控制参数个数
    2.处理特殊文件名需要采用如下方式:
    find . -name "*.txt" print0 |xargs -0 rm {} 

find /opt/test/ -type f -name "*.txt" -exec cp {} /tmp \;

find /opt/test/ -type f -name "*.txt" | xargs -i cp {} /tmp

linux find查找并拷贝 exec xargs区别

标签:使用   find   特殊字符   test   linux   nbsp   linu   命令   字符   

原文地址:http://www.cnblogs.com/howhy/p/6385736.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!