Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Deleting old archive log files.
Hi Mark,
We use xxcopy utility to do that. but here is the sample script to do this.
http://www.ultratech-llc.com/KB/?File=DelOld.TXT
Delete Files Older Than XX Days
Last Modified: 15 Aug 2001
The following batch file will step through the specified starting folder (%_at_FOLDER%) and its subfolders, and delete all files older than %_at_AGE%.
It requires the use of Windows NT4 or higher, and several utilities from the Resource Kit, such as FORFILES and ROBOCOPY v1.95 or higher.
The folder must be the shortname if entered at the command line. Longname folders should be entered directly into the batch file.
The syntax is:
DELETEOLD.BAT folder age
Example:
DELETEOLD D:\LOGS 25
See version "D" for a version compatible with both NT4 and Win2K. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ECHO OFF
rem ============================================================== rem === Initialize Environment Variablesrem === Last Modified On 06 Jul 2000
rem ==============================================================:Variables
SET @FOLDER=%1& IF /I "%1"=="" SET @FOLDER=C:\TEMP SET @AGE=%2& IF /I "%2"=="" SET @AGE=30 SET @LOGFILE="%_at_FOLDER%\DeleteOld.LOG" rem ============================================================== rem === Recurse Through Subfolders And Delete Old Filesrem === Last Modified On 17 Oct 2000
rem ==============================================================:SetFolders
rem ============================================================== rem === Reset Environment Variables and Exit Batch Filerem === Last Modified On 27 Jun 2000
rem ==============================================================:ExitBatch
rem ============================================================== rem === SUBROUTINE: Remove Files That Are Over XX Days Oldrem === Last Modified On 17 Oct 2000
rem ==============================================================:RemoveFiles
ECHO. >>%_at_LOGFILE% ECHO -- Purging "%*"...
DEL "%*" >>%_at_LOGFILE%
Mark Leith wrote:
> > Hi All, > > To save me re-inventing the wheel: > > Does anybody have a batch script (that runs on NT) that deletes archive log > files that are older than X days old? I've looked at the DEL command, but > this doesn't have a date/time based attribute parameter.. > > Has anybody been through this already? > > All help appreciated! > > Mark > > =================================================== > Mark Leith | T: +44 (0)1905 330 281 > Sales & Marketing | F: +44 (0)870 127 5283 > Cool Tools UK Ltd | E: mark_at_cool-tools.co.uk > =================================================== > http://www.cool-tools.co.uk > Maximising throughput & performance > > -- > Please see the official ORACLE-L FAQ: http://www.orafaq.com > -- > Author: Mark Leith > INET: mark_at_cool-tools.co.uk > > Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 > San Diego, California -- Public Internet access / Mailing Lists > -------------------------------------------------------------------- > 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).
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Joan Hsieh INET: joan.hsieh_at_tufts.edu Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- 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 04 2002 - 07:43:25 CST