Thursday, April 11, 2013

UNIX - clearing out files that are older than 30 days

Useful command for clearing out old files:
find ./* -type f -mtime +30 -exec rm {} \;
The above will clear out files that are older than 30 days in the current directory. find ./* will look at the current directory, grabbing all the files (*), -mtime +30 will specify files that are older than 30 days, and -exec rm {} \ will remove all the files that match the condition.

No comments:

Post a Comment