» IT tipps and howto's
How To: Delete files older than x days
This is actually VERY simple - if you know how to do it. In combination with
the command find, you are able to look for files and folders with a
certain age, followed by a command.
The following example deletes all files within the actual directory which are
older than 7 days (now +7).
Important: Don't forget {} \; at the end of the command!
find . -name '*' -mtime +7 -exec rm -f {} \;
Last Update: 23.05.2008
|