Posted By

inkdeep on 01/26/09


Tagged

Bash terminal nix cron tmp


Versions (?)

clear /tmp of files older than 3 days


 / Published in: Bash
 

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.

  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  

You need to login to post a comment.