Question : Why is 28-04-2009 different from 28-04-2009

Hi Scripting experts

I have made a simple script to rename some html files in a folder but I'm having problems with some of the logic.
I want the script to only copy and rename files from "today" but its not working.

If i change the operator in the line "If Fildato = Date Then" from "=" to "<>" all files are copied and renamed correctly.

Why is 28-04-2009 (Fildato) different from 28-04-2009 (Date) ?!? ;-)

I hope that someone are able to help with this little problem.

Best Regards
Søren
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
Const OverwriteExisting = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")
 
prog = WshShell.ExpandEnvironmentStrings("%ProgramFiles%")
objStartFolder = prog & "\uptime4\GUI\published\" & Year(Date) & "\" & (MonthName((Month(Date))))
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
 
For Each objFile in colFiles
Fildato = (Left(objFile.datelastmodified, 10))
If Fildato = Date Then
pos=InStr(objFile.Name,"_")
Filnavn = (Left(objFile.Name,pos-1)) & "_current.html"
objFSO.CopyFile objStartFolder & "\" & objFile.Name , objStartFolder & "\" & Filnavn , OverwriteExisting
End If
Next
Open in New Window Select All

Answer : Why is 28-04-2009 different from 28-04-2009

This may be a silly question, I know, but humor me.
Have 'Fildato' and 'Date' both been declared as the same data type?
I've seen where there can be a compatibility issue when the data types differ.

Anyway, just a suggestion.
-Tim
Random Solutions  
 
programming4us programming4us