Deleting files older than 10 days in unix




















Delete files older than 10 Days in a directory. Registered User. Join Date: May If there is no files exists to remove older than 10 days, It should not do anything.

Thanks Jo. Join Date: Mar Code :. Delete files older than 10 Days in a directory Reply to Thread. I tried as below Code :. Last edited by radoulov; at AM.. Join Date: Apr Originally Posted by rajeshjohney. Hi I tried by including the path as below. Last edited by Franklin52; at AM.. Reason: Please use code tags.

First run: Quote:. Want to delete directory, subdirectories and all files which are older than 7 days. Delete files older than X days. Hi All, I am using below code to delete files older than 2 days. In case if there are no files, I should log an error saying no files to delete. Best Smart Displays. Best Home Security Systems. Best External Solid State Drives. Best Portable Chargers.

Best Phone Chargers. Best Wi-Fi Range Extenders. Best Oculus Quest 2 Accessories. Awesome PC Accessories. Best Linux Laptops. Best Wireless iPhone Earbuds. Best Bluetooth Trackers. Best eReaders. Best VPN. Browse All News Articles. Baby Shark YouTube. Venmo Gifts.

Fortnite iPhone. Quest Headset SteamVR. M1 Mac Dropbox. This article explains how to delete files older or newer than N days, with extra examples like matching only files using a particular extension, and more. For this we'll use find , a command line tool to search for files in a directory. Replace it with the path of the directory from which you want to delete files and folders older than N days -mindepth 1 is used to not apply any tests or actions at levels less than the specified level.

You can skip it in all the commands mentioned in this article if you want to also match the specified find path. Replace N with a number integer. In this command, files with a modification time older than N days will be deleted. For other ways of deleting files that works with all implementations, read the observations further down this article. Want to test the command without removing any files or folders?

You should add -delete after matching the files.



0コメント

  • 1000 / 1000