I am writing vbscript code that checks for existence of file in a folder and if the file exists, should actually compare the file creation date with the system date. if they are equal, it should rename the file to .old extention.
I have hard time to compare two dates. How to compare two dates (short format).
Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.GetFile("C:\code\OpicsEod\check.vbs") If objFile.Size > 0 Then
if date = cdate(objFile.DateCreated) Then wscript.Echo "same date" else wscript.Echo "not same date" end if Else Wscript.Echo "The file is empty." End If