Detect files changed since "n" daysTag(s): WSH VBScript
[filechange.vbs]
Function FilesModifiedSince (FolderSpec, Days)
Dim fso, fc, f, d
Set fso = CreateObject("Scripting.FileSystemObject")
Set fc = fso.GetFolder(FolderSpec).Files
Set d = CreateObject("Scripting.Dictionary")
For Each f in fc
If DateDiff("d", f.DateLastModified, Now) <= Days Then d.Add f, f.DateLastModified
Next
Set fso = Nothing
Set fc = Nothing
Set FilesModifiedSince = d
End function
' Example, get all the files modifed since 5 days
' in the specified directory
Dim a, f
Set f = FilesModifiedSince("c:\dev\work\Scripting", 5)
a = f.keys
b = f.items
For i = 0 To f.count - 1
WScript.Echo a(i) & " " & b(i)
Next
Set f = Nothing
WScript.Quit(0)
mail_outline
Send comment, question or suggestion to howto@rgagnon.com
Send comment, question or suggestion to howto@rgagnon.com