I wanted to edit an existing shell script that I have that will delete only the *.log files older than 7 days. My existing script will delete all files older than 7 days. It is as follows:
# Oracle Archive Log Clean-up Process
#
PATH=.:/usr/local/bin:$PATH
ORACLE_SID=$1
ORAENV_ASK=NO
export PATH ORACLE_SID ORAENV_ASK
. /usr/local/bin/oraenv
#
echo "Starting Oracle Archive Log Clean-up Process"
cd /u01/app/oracle/product/ora10g/dbs
echo "Files being deleted ..."
find . -mtime +7 print
find . -mtime +7 -exec rm {} \;
echo "done ... Oracle Archive Log Clean-up Process"
Why? I have other files other than *.log files in this directory. Running the script would delete files that I need because it doesn't discrimate against the file type.