码迷,mamicode.com
首页 > 其他好文 > 详细

find 与 tar命令连用

时间:2014-09-02 00:00:33      阅读:286      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   ar   文件   div   问题   log   sp   

find 与 tar命令连用  

今天打包日志时,用

find -mtime -1 -type f -exec tar -cvf log.tar {} \;

 

发现只打包了最后一个文件,应该是tar的c参数,每次都创建一个新的文件,想了下用r参数代替,没有问题了

 find -mtime -1 -type f -exec tar -cvf log.tar {} \;

 

再多试了下,下面2个命令写法也是一样效果:

 tar -cvzf 11.tarz $(find -mtime -1 -type f)
find . -name *11*.txt | xargs tar -rvf 11.tar; gzip 11.tar

 

find 与 tar命令连用

标签:style   blog   color   ar   文件   div   问题   log   sp   

原文地址:http://www.cnblogs.com/mjorcen/p/3950461.html

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