/ 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
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
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
find /tmp/ -type f -mtime +1 -exec rm {} \;