Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Help with Unix find command
I used following command set and put them into a shell script to execute
once a day
APP_SCRATCH is defined in the application environment
#!/bin/csh -f
# Description: Cleans up the temporary files on SCRATCH that are older than
1 week in directory
#
#
find $APP_SCRATCH -path "*.txt" -atime +7 -exec /bin/rm {} ';' > /dev/null find $APP_SCRATCH -path "*.com" -atime +7 -exec /bin/rm {} ';' > /dev/null find $APP_SCRATCH -path "*.LOG" -atime +7 -exec /bin/rm {} ';' > /dev/nullexit
HTH Regards
Shiva
-----Original Message-----
Sent: Thursday, April 10, 2003 11:44 AM
To: Multiple recipients of list ORACLE-L
oracle_at_typeOMENU:> export ORACLE_SID=openview
oracle_at_openview:> find . -name ""${ORACLE_SID}_exp_full*.log"" -mtime +1
exec ls {} \;
find: missing conjunction
oracle_at_openview:> find . -name "${ORACLE_SID}_exp_full*.log" -mtime +1 exec
ls {} \;
find: missing conjunction
oracle_at_openview:> find . -name '${ORACLE_SID}_exp_full*.log' -mtime +1 exec
ls {} \;
find: missing conjunction
oracle_at_openview:>
-----Original Message-----
Sent: Thursday, April 10, 2003 11:29 AM
To: Multiple recipients of list ORACLE-L
In Unix shells, variables and wildcards get parsed BEFORE they get passed to the program. This is fine most of the time, like when you "ls mydir/*", but not for find.
Try enclosing the ${ORACLE_SID}_exp_full*.log in quotes (double or single).
HTH! GL! :) Rich
Rich Jesse System/Database Administrator rich.jesse_at_qtiworld.com Quad/Tech International, Sussex, WI USA
p.s. I hope I was the intended recipient of this e-mail. If not, ignore my error!
-----Original Message-----
Sent: Thursday, April 10, 2003 9:59 AM
To: Multiple recipients of list ORACLE-L
I am trying to format a find command to delete files older than n days. The command is in a script and incorporates the ORACLE_SID variable. I can't get the command to work with the first part of the file name as a variable. It works fine if I hard code it. Any ideas?
Example: find . -name ${ORACLE_SID}_exp_full*.log -mtime +1 -exec ls {} \;
Thanks!
Ron
--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: Jesse, Rich
INET: Rich.Jesse_at_qtiworld.com
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services ---------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). If you are not the intended recipient of this e-mail message, any use, distribution or copying of the message is prohibited. Please let me know immediately by return e-mail if you have received this message by mistake, then delete the e-mail message. Thank you.
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services ---------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services ---------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Thu Apr 10 2003 - 13:29:16 CDT