I have a folder 'script'. People check-in the files to this folder. Every time they check-in, I need to get the those files alone and execute them. For that, current timestamp needs to be saved in some log file. so that we can get the files that are modified after the last build by comparing the current time with last execution time(which is saved in log file). Let me explain that clearly.
Folder name -- script.
there three files in this folder -- a.sql, b.sql, c.sql
after few hours -- two new files are created. also b.sql is modified. totally five files -- a.sql, b.sql, c.sql, d.sql, e.sql
now I need to execute only those two new files and one modified file.
it should be like below
b.sql
d.sql
e.sql
we need to compare the current time with last execution time and get the files that are modified/created between two timestamps.
Can someone tell me how to do it using vbscript or windows script?
Look at the docs and this demo code:
Option Explicit
Const Archive = 32
Dim goFS : Set goFS = CreateObject("Scripting.FileSystemObject")
Dim oFile
For Each oFile In goFS.GetFolder("..\data").Files
WScript.Echo oFile.Name, oFile.Attributes
If oFile.Attributes And Archive Then
WScript.Echo oFile.Name, "execute and clear archive bit"
oFile.Attributes = oFile.Attributes - Archive
End If
Next