{"id":166,"date":"2017-11-16T14:59:12","date_gmt":"2017-11-16T12:59:12","guid":{"rendered":"http:\/\/blog.chloesoe.ch\/?p=166"},"modified":"2019-09-17T15:43:22","modified_gmt":"2019-09-17T13:43:22","slug":"find-by-date-and-tar-them","status":"publish","type":"post","link":"https:\/\/blog.chloesoe.ch\/?p=166","title":{"rendered":"find by date and tar them"},"content":{"rendered":"<p>If you have a big log folder and you want to tar the newest log files in to one tar.gz file, then you can use the following:<\/p>\n<pre><code>find \/opt\/tomcat\/logs\/ -type f -newermt 2013-06-09 | tar cvzf testfind.tar.gz -T - --null<\/code><\/pre>\n<p>I do not know the meaning of <code>-T - --null<\/code>, but it works.<\/p>\n<p>&nbsp;<\/p>\n<p>Perhaps your find version is to old for the <code>newermt<\/code> statement. With find version 4.2.27 it did not work. Then you could use <code>-mtime<\/code>, for modification time.<br \/>\n<code>mtime<\/code> is the number * 24 h, do find all files older newer then one day, you can use:<\/p>\n<pre><code>find \/opt\/tomcat\/logs\/ -type f -mtime 1<\/code><\/pre>\n<p>+1 would mean older than one day<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you have a big log folder and you want to tar the newest log files in to one tar.gz file, then you can use the following: find \/opt\/tomcat\/logs\/ -type f -newermt 2013-06-09 | tar cvzf testfind.tar.gz -T &#8211; &#8211;null I do not know the meaning of -T &#8211; &#8211;null, but it works. &nbsp; Perhaps&#8230; <a href=\"https:\/\/blog.chloesoe.ch\/?p=166\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">find by date and tar them<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-166","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=\/wp\/v2\/posts\/166","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=166"}],"version-history":[{"count":3,"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=\/wp\/v2\/posts\/166\/revisions"}],"predecessor-version":[{"id":537,"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=\/wp\/v2\/posts\/166\/revisions\/537"}],"wp:attachment":[{"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=166"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=166"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}