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.
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
Filnavn = (Left(objFile.Name,pos-1)) & "_current.html"
objFSO.CopyFile objStartFolder & "\" & objFile.Name , objStartFolder & "\" & Filnavn , OverwriteExisting