I don't understand why but teh below VBScript is giving no output, the problem seems to be in the last if statement but I can't see anything wrong with it can anyone advise?
Dim objFSo, strDirToClean, deleteFilesOlderThanDays
If WScript.Arguments.Count = 2 Then
Set args = WScript.Arguments
strDirToClean = args.Item(0)
deleteFilesOlderThanDays = args.Item(1)
If strDirToClean.equals("/?") Then
wscript.echo "Usage: directory to clean no of days to delete files older than"
Set objFSo = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strDirToClean)
Set colFiles = objFolder.Files
For Each objFile in colFiles
fileModifyDate = objFile.DateLastModified
daysSinceModify = datediff("d", fileModifyDate, date) 'Delete file only if it is older than modify date specified
'wscript.echo daysSinceModify & " " & deleteFilesOlderThanDays
If daysSinceModify > deleteFilesOlderThanDays Then
wscript.echo "Deleting file " & objFile.name & " Last modified " & daysSinceModify & " days ago"
' objFSO.DeleteFile(objFile) 'uncomment when we can be sure that the logic is right