DateLastModified does not work for .pdf

Asked By andrei peri
07-Jan-10 12:27 AM
Earn up to 10 extra points for answering this tough question.
Hi all,
pls. help with a frustrating problem:
I am running this VBS from this  shell on XP professional service pack 2.
It should copy all files modified since last run.
All is fine until the source dir contains pdf files.
What's different with them ?!
Pls put me out of my misery.

the shell:
filelist.vbs c:\andrei\sela\pdf\ c:\andrei\DW\ c:\andrei\sela\  pointer-given.txt

the script:
' VB Script Document

' Arguments : source folder name, target folder name, Work Folder, pointer file name
On Error Resume Next
  Dim fso, folder, files, NewFile,sFolder, FileDate, FileName, LastModified, PointerFile, PointerFileName
  Dim LatestDate, PointerDate
  Set fso = CreateObject("Scripting.FileSystemObject")
  sFolder = Wscript.Arguments.Item(0)
  tFolder = Wscript.Arguments.Item(1)
  wFolder = Wscript.Arguments.Item(2)
  PointerFile =  Wscript.Arguments.Item(3)

  If sFolder = "" Then
      Wscript.Echo "No Source Folder parameter was passed"
      Wscript.Quit
  End If
 If tFolder = "" Then
      Wscript.Echo "No Target Folder parameter was passed"
      Wscript.Quit
  End If
 If PointerFile= "" Then
      PointerFile = "Pointer-default.txt"
  End If
' If wFolder = "" Then
 '     wFolder = "c:\andrei\sela\"
 ' End If
 
If fso.FileExists(PointerFile)  then
     Set NewFile = fso.OpenTextFile(PointerFile, 1, True)
'    msgbox("PointerFile opened : " & PointerFile)

  else
'    msgbox("PointerFile create : " & PointerFile)
   Set NewFile = fso.CreateTextFile(PointerFile, True)

  end if
 
PointerDate=NewFile.readline
NewFile.Close
If PointerDate="" Then
PointerDate=Now()
'    msgbox("PointerDate : " & PointerDate)

else
'msgbox("PointerDate  from NewFile: " & PointerDate)
End if
LatestDate=PointerDate
Set folder = fso.GetFolder(sFolder)
Set files = folder.Files
   

 For each folderIdx In files
   
Set FileName = fso.GetFile(folderIdx.Name)
' set FileDate = FileName.DateLastModified

FileDate=""
FileDate=(FileName.DateLastModified)
msgbox("folderIdx.Name  : " & folderIdx.Name)
msgbox("FileDate  : " & FileDate)

d=DateDiff("s" ,LatestDate , FileDate)
'msgbox(d)


if d > 0 Then

tFile=tFolder
sFile=FileName

fso.CopyFile sFile, tFile, TRUE

d=DateDiff("s" ,OldestDate , FileDate)
if d > 0 Then
OldestDate=FileDate
end if

end if

Next
'    msgbox("LatestDate : " & LatestDate)

Set NewFile = fso.OpenTextFile(PointerFile, 2, True)
NewFile.WriteLine(OldestDate)
NewFile.Close

 WScript.Quit


Create New Account