Return to Snippet

Revision: 3642
at September 3, 2007 04:55 by wolfie


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

Revision: 3641
at August 28, 2007 05:18 by wolfie


Initial Code
find /tmp/ -type f -mtime -1 -exec rm {} \;

Initial URL

                                

Initial Description
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

Initial Title
How to remove files that are over 1 day old

Initial Tags
file, Bash

Initial Language
Bash