Difference between revisions of "Linux Shell - Remove Folders older than n days"

(Created page with "Example: How to remove folders in the folder "/home/tmp" that are older than 10 days. Change the number ten to any number you like. <pre>find /home/tmp/* -mtime +10 -exec rm...")
 
(No difference)

Latest revision as of 10:16, 23 August 2020

Example: How to remove folders in the folder "/home/tmp" that are older than 10 days. Change the number ten to any number you like.

find /home/tmp/* -mtime +10 -exec rm -r {} \;

The command that you want to execute for folder (that is found) is added with the argument "-exec".