Script to Delete files older than X days Usage: cscript c:\scripts\deloldfiles.vbs c:\windows\system32\logfiles 30 >> c:\scripts\iis.log Scrpit Code: ----------------------------------------------------------------------------------------- ' Objective: To delete old files from a given folder and all subfolders below ' ' Created by: MAK June 21, 2005 ' ' Format: cscript deloldfiles.vbs {DriveLetter:\FolderName} {#ofDays} ' or: cscript deloldfiles.vbs {\\servername\FolderName} {#ofDays} ' Example: cscript deloldfiles.vbs c:\dba\log 3 ' (deletes files older than 3 days from the \dba\log file on drive C:) Set objArgs = WScript.Arguments FolderName =objArgs(0) Days=objArgs(1) set fso = createobject("scripting.filesystemobject") set folders = fso.getfolder(FolderName) datetoday = now() newdate = dateadd("d", Days*-1, datetoday) wscript.echo "Today:" & now() wscript.echo "Started deleting files older than :" ...