Posted By

wolfie on 08/28/07


file Bash removal crontab

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


How to remove files that are over 1 day old

 / Published in: Bash

A one-liner to remove any temporary files modified over one day ago. Removes files from /tmp/ Run without the '-exec rm {} \;' part to check that it is matching the right set of files - this can be dangerous if run by root! If you want to remove files modified today, change +1 to -1 This can be useful to add into crontab though

  1. find /tmp/ -type f -mtime +1 -exec rm {} \;

Report this snippet  

You need to login to post a comment.