The attached script requires windows scripting host to be installed.
Peter Berry
'==========================================================================
'
' NAME: Delete_old.vbs
'
' AUTHOR: peter berry , allergy therapeutics
' DATE : 04/09/2000
'
' COMMENT: Delete files n days old from a specified directory
'
'==========================================================================
dim rootdir, daysold, files, file, filesystem, rootfolder, datemod, deadline
dim datetoday
' Get the root directory and days parameters
' If the incorrect number of parameters are specified show usage and quit
if wscript.Arguments.count <> 2 then
' Show usage
wscript.Echo "USAGE: delete_old.vbs [target directory] [Days old]"
wscript.Echo ""
wscript.Echo " Given a target directory, delete_old will
delete"
wscript.Echo " all files older than the specified number
of"
wscript.Echo " days."
wscript.Quit 0
else
rootdir = wscript.Arguments(0)
daysold = wscript.Arguments(1)
wscript.Echo "Delete files more than " & daysold & " days old from "
& rootdir
end if
' open the root directory
' Instantiate the filesystemobject
set filesystem = createobject("Scripting.FileSystemObject")
set rootfolder = filesystem.GetFolder(rootdir)
if err.Number <> 0 then
' Display the error that occurred
wscript.Echo "(" & Err.Number & ") " & err.Description
wscript.Echo ""
wscript.Echo "The path that you entered is invalid, select a
different path"
wscript.Quit err.Number
end if
' print todays date and deadline
datetoday = date
wscript.Echo "Todays date:" & DateToday
' Check daysold variable is integer
deadline = datetoday - daysold
wscript.Echo "Cutoff = " & deadline
'Find all files in the root folder
set files = rootfolder.Files
' For each file in folder
for each file in files
' Determine Date modified
datemod = file.datelastmodified
'Print date last modified
wscript.Echo "file " & file & " last modified on " & datemod
'Show us what you are going todo!
if datemod >= deadline then
wscript.Echo "Will not be deleted"
else
Wscript.Echo "For the chop"
file.delete
wscript.Echo "Chopped!"
end if
next
'==========================================================================
-----Original Message-----
From: Raja Ravipati [mailto:[Email Address Removed]
Sent: 30 October 2001 21:09
To: LazyDBA.com Discussion
Subject: Nt script to delete archivelogs periodically
Hi!
Is any body has a NT script to delete archivelogs periodically by age.
Thankyou in advance.
Raja
--------
Oracle documentation is here:
http://tahiti.oracle.com/pls/tahiti/tahiti.homepage
To unsubscribe: send a blank email to oracledba-[Email Address Removed] subscribe: send a blank email to oracledba-[Email Address Removed] the list archive: http://www.LAZYDBA.com/odbareadmail.pl
Tell yer mates about http://www.farAwayJobs.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html
Oracle LazyDBA home page