find与tar的结合使用

新建一个文件,自定义时间点
[root@nhserver2 ~]# touch -t 1403010000.00 file1.txt   新建一个文件,自定义时间点
[root@nhserver2 ~]# ll --full-time

[root@nhserver2 ~]# find ./ -type f -newer file1.txt

只要第一层
[root@nhserver2 ~]# find ./ -maxdepth 1 -type f -newer  file1.txt


在~处打包为tar,z参数为压缩
[root@nhserver2 ~]# find ./ -maxdepth 1 -type f -newer  file1.txt | xargs tar -zcvf 111.tar
解压,打包有z参数,解压也要有z参数。-C指定解压的目的地
[root@nhserver2 ~]# tar -zxvf 111.tar -C ~

原文地址:https://www.cnblogs.com/nhlinkin/p/3633469.html