The unix command to list/remove files that are older than n days is given below.
Command To List :
find ./ –mtime +5 –exec ls –l '{}' \;
Command To Delete :
find ./ –mtime +5 –exec rm –f '{}' \;
| Section of command | Explanation |
| find | unix find command |
| ./ | current directory (can specify any directory) |
| -exec | to execute other commands within find |
| -mtime +5 | To find the files that are not modified atleast 5 days ago. |
| ls –l or rm -f | To list or remove |
| ‘{}’ | for each iteration this will be replaced by the next filename |
| \; | indicated the end of inner ls or rm command |
Hope this help…
Cool…