Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: unix question
The following statement will delete all files older than 5 days:
find . -name 'files_you_want_to_delete*.log' -mtime +5 -exec rm {} \;
To test it, change the name of the file name and change the 'rm' to
'ls'.
It should just list the files older than 5 days. That way you know it
is working.
Ron Smith
-----Original Message-----
Sent: Wednesday, November 19, 2003 3:10 PM
To: Multiple recipients of list ORACLE-L
USE WITH CARE.USE WITH CARE.USE WITH CARE.USE WITH CARE.USE WITH
CARE.USE WITH CARE.USE WITH CARE.
COUNT=`ls -lrt <dir>/<name>|wc -l`
if [ $COUNT -ge 4 ] ;
then
find <dir> -name <name> -mtime +4 -exec rm -f {} \; fi
USE WITH CARE.USE WITH CARE.USE WITH CARE.USE WITH CARE.USE WITH
CARE.USE WITH CARE.USE WITH CARE.
HTH,
Bambi.
-----Original Message-----
Sent: Wednesday, November 19, 2003 2:21 PM
To: Multiple recipients of list ORACLE-L
I want to store some files. I make a new copy every night. I want to archive it back 4 days. So after 4 days, I want to delete the old copy. How do I do this?
However, if i miss a nightly batch and have less than 4 copies, I do not want to delete any?
--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: <ryan_oracle_at_cox.net
INET: ryan_oracle_at_cox.net
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).
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.
--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: Smith, Ron L.
INET: rlsmith_at_kmg.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). Received on Wed Nov 19 2003 - 15:50:12 CST