clear /tmp of files older than 3 days


/ Published in: Bash
Save to your folder(s)

Clear files in /tmp directory that are older than three days - terminal/cron
this is a very simple example - could also remove by last access time, etc.


Copy this code and paste it in your HTML
  1. #command line / shell script
  2. sudo find /tmp -depth -type f -atime +3 -exec rm {} \;
  3.  
  4. #crontab
  5. 0 0 * * * /usr/bin/find /tmp -atime +3 -exec /usr/bin/rm {} \;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.