You should bookmark and note http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/scriptinga.asp more generally. The following vbscript will do what you specifically ask. Fell free to remove the debug stuff which just bulks it out once you understand it. Rem ***************************************** Rem * This script deletes archive log files * rem * which are more than <iDays> old * Rem * From archive log directory * Rem * * Rem ***************************************** Rem Rem ***************************************** Rem * Version History: * Rem * 0.1 Niall Litchfield 29/08/2003 * Rem ***************************************** ' Constants alter if necessary const iDays = 7 ' Change this to change archive retention period const arch_dest = "<location of files to delete" dim today,arch_date today = Now() arch_date = today - iDays DeleteArchives arch_dest,arch_date Sub DeleteArchives(strFolder,modDate) ' sub routine to delete archives older than ' modDate. Called twice Dim fileSystem ' Filesystem Object Dim folder ' Folder Dim file ' File Object dim debug ' change to enable interactive debugging via message boxes debug = false If debug = true then msgBox strFolder msgBox modDate end if ' Create the filesystem object set filesystem = createobject("Scripting.FileSystemObject") ' get the Folder set folder = fileSystem.GetFolder( strFolder) ' create a file enumerator For each filename in folder.files ' get file object set file = fileSystem.GetFile( fileName) ' get date last modified dateLastModified = file.DateLastModified if debug = true then msgBox "File: " & fileName & vbcrlf & " Last Modified: " & dateLastModified end if ' if file is older than NUMBER_OF_DAYS if dateLastModified < modDate then ' delete the file if not in debug mode if debug = false then fileSystem.DeleteFile (fileName) end if end if next End Sub On 1/7/07, J. Dex <cemail_219@xxxxxxxxxxx> wrote:
Does anyone have a script for Windows that will archive old network log and trace files and also remove any that are more than a month old (or at least be able to run under a monthly scheduled task)? I have done this in UNIX but not on Windows. _________________________________________________________________ Communicate instantly! Use your Hotmail address to sign into Windows Live Messenger now. http://get.live.com/messenger/overview -- //www.freelists.org/webpage/oracle-l
-- Niall Litchfield Oracle DBA http://www.orawin.info