{"id":278002,"date":"2021-06-18T14:30:00","date_gmt":"2021-06-18T11:30:00","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/how-to-find-or-delete-files-less-than-x-minutes-old-on-linux-cloudsavvy-it\/"},"modified":"2021-06-18T14:30:00","modified_gmt":"2021-06-18T11:30:00","slug":"how-to-find-or-delete-files-less-than-x-minutes-old-on-linux-cloudsavvy-it","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/how-to-find-or-delete-files-less-than-x-minutes-old-on-linux-cloudsavvy-it\/","title":{"rendered":"#How to Find or Delete Files Less Than X Minutes Old on Linux \u2013 CloudSavvy IT"},"content":{"rendered":"<p><strong>&#8220;#How to Find or Delete Files Less Than X Minutes Old on Linux \u2013 CloudSavvy IT&#8221;<\/strong><\/p>\n<div id=\"article-content-area\">\n<img loading=\"lazy\" decoding=\"async\" class=\"type:primaryImage alignnone size-full wp-image-4038\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2017\/07\/add8ac45.png?width=1198&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Bash Shell\" width=\"1400\" height=\"600\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Say you just ran some script that was supposed to move files around or <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">download<\/a> stuff, or anything else that involves files, and then you realize that you need to figure out what files just got created and where. And maybe you need to delete them.<\/p>\n<p>First you\u2019ll want to use the find command to figure out what files were created, and then using the <code>mmin<\/code> argument to specify files less than x minutes. If you want to specify only files, you can use the <code>-type f<\/code> argument to only check for files.<\/p>\n<p>So if you want to check in the current folder, including subfolders, for files created in the last 5 minutes, you can use the following command:<\/p>\n<pre>find .\/ -type f -mmin -5<\/pre>\n<p>To delete files we can use the <code>-exec rm {} ;<\/code> argument, which is a little confusing, but basically you\u2019re telling the exec argument to remove the files.<\/p>\n<p>So to delete all files in the current folder, including subfolders, created in the last 5 minutes, use this command:<\/p>\n<pre>find .\/ -type f -mmin -5 -exec rm {} ;<\/pre>\n<p>If you wanted to specify files older than X days instead, you could use the <code>-mtime<\/code> argument \u2014 for instance, this command would delete files older than 10 days:<\/p>\n<pre>find .\/ -type f -mtime +10 -exec rm {} ;<\/pre>\n<p>Much easier than looking at the man page.\n<\/p><\/div>\n<blockquote><p><strong><span style=\"color: #ff6600;\">If you liked the article, do not forget to share it with your friends. Follow us on\u00a0<span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"https:\/\/news.google.com\/publications\/CAAqBwgKMLG0nwswvr63Aw\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google News<\/a><\/span>\u00a0too, click on the star and choose us from your favorites.<\/span><\/strong><\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.cloudsavvyit.com\/146\/how-to-find-or-delete-files-less-than-x-minutes-old-on-linux\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#How to Find or Delete Files Less Than X Minutes Old on Linux \u2013 CloudSavvy IT&#8221; Say you just ran some script that was supposed to move files around or download stuff, or anything else that involves files, and then you realize that you need to figure out what files just got created and where&#8230;.<\/p>\n","protected":false},"author":1,"featured_media":278003,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2017\/07\/add8ac45.png","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-278002","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/278002","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=278002"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/278002\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/278003"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=278002"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=278002"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=278002"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}