UNIX Commands to delete older files
Recently I wrote the following UNIX command line code to delete the older files in report repository and log files. I thought it might be useful for some one.
Reports Delete
find /psreports/PSPROD/* -type d -prune -mtime +15 -exec /bin/rm -R {} \;
The above command will delete all the directories under /psreports/PSPROD directory which are 15 days or older.
App Server Logs Delete
find /appserv/PSPROD/LOGS/* -type f -prune -mtime +15 -exec /bin/rm -R {} \;
The above command will delete all the application server log files under /appserv/PSPROD/LOGS directory which are 15 days or older.
Process Scheduler Logs Delete
find /appserv/prcs/PSPROD/LOGS/* -type f -prune -mtime +15 -exec /bin/rm -R {} \;
The above command will delete all the process scheduler server log files under /appserv/prcs/PSPROD/LOGS/ directory which are 15 days or older.