{"id":2306,"date":"2019-07-27T20:41:41","date_gmt":"2019-07-27T20:41:41","guid":{"rendered":"http:\/\/www.incredigeek.com\/home\/?p=2306"},"modified":"2019-07-27T20:42:17","modified_gmt":"2019-07-27T20:42:17","slug":"delete-files-older-than-x-days-linux","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/delete-files-older-than-x-days-linux\/","title":{"rendered":"Delete files older than x days &#8211; Linux"},"content":{"rendered":"\n<p><br>You can use find command to find and delete files older than the specified days.  In this case 30.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">find \/backup\/* -mtime +30 -exec rm {} \\;<\/pre>\n\n\n\n<p>Non recursive example.  The -prune option should limit find to only look for files in the \/backup directory.  So it won&#8217;t check any subdirectories. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">find \/backup\/* -prune -mtime +30 -exec rm {} \\; <\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can use find command to find and delete files older than the specified days. In this case 30. find \/backup\/* -mtime +30 -exec rm {} \\; Non recursive example. The -prune option should limit find to only look for &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/delete-files-older-than-x-days-linux\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/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":[4,3],"tags":[567,677,7,675,676],"class_list":["post-2306","post","type-post","status-publish","format-standard","hentry","category-command-line","category-linux","tag-delete","tag-find","tag-linux-2","tag-remove","tag-rm"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/2306","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/comments?post=2306"}],"version-history":[{"count":3,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/2306\/revisions"}],"predecessor-version":[{"id":2539,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/2306\/revisions\/2539"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=2306"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=2306"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=2306"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}