I'm trying to code a DLL updater that just copies the new versions of some already existant DLL files to my working folder. This is just to keep the DLLs updated as my coleagues release new versions.
This is the code I came up with after reading some tutorials.
Dim strSourceFolder, strDestFolder
strSourceFolder = "C:\Users\myName\Desktop\Win64"
strDestFolder = "C:\Program Files\Common Files\Company\Pruebaupdater"
For Each file In StrSourceFolder
If File.Type = "dll" Then
ReplaceIfNewer
End If
Next
Sub ReplaceIfNewer (SourceFile, DestFolder)
Dim filesys, demofile, date1, date2
Set filesys = CreateObject("Scripting.FileSystemObject")
Set demofile = filesys.GetFile("filename1")
date1 = demofile.DateLastModified
demofile = filesys.GetFile("filename2")
date2 = demofile.DateLastModified
If DateDiff("d", date1, date2) > 0 Then
**copy SourceFile** to SourceFolder
End If
End Sub
When the script reaches the copy function, I get an 800A0401 at line 21 character 20 - End of instruction expected. This copy function is right the same in every bit of code I've seen.
One of my sources is this and there's no comment there as of the copy function, so I guess this works for them.