Option Explicit Dim s_ObjFso Set s_ObjFso = createobject("scripting.filesystemobject") if wscript.arguments.count > 1 then if s_ObjFso.folderexists(wscript.arguments(0)) then Dim s_ObjFiles,s_ObjFile Set s_ObjFiles = s_ObjFso.GetFolder(wscript.arguments(0)).files for each s_ObjFile in S_ObjFiles Call Wscript.echo ("") Call Wscript.echo ("Name: " & s_ObjFile.Name) Call Wscript.echo ("Created: " & s_ObjFile.DateCreated) Call Wscript.echo("Age (days): " & Datediff("d",cdate(s_ObjFile.DateLastModified),cdate(now()))) if Cint(Datediff("d",cdate(s_ObjFile.DateLastModified),cdate(now()))) > 7 then if lcase(wscript.arguments(1)) = "yes" then Call Wscript.echo ("Status: Deleted") Call s_ObjFile.delete(true) else Call Wscript.echo ("Status: To be deleted") end if Else Call Wscript.echo ("Status: Not to be deleted") End if Next Set s_ObjFiles = nothing else Call Wscript.echo("Folder " & wscript.arguments(0) & " doesn't exits") end if else Call Wscript.echo("Usage: Cscript 7days.vbs [folder2check] [really delete?]" ) Call Wscript.echo("Example: Cscript 7days.vbs D:\testdeletion\ yes" ) end if Set s_ObjFso = nothing