Skip to content

Instantly share code, notes, and snippets.

@software-mariodiana
Last active December 21, 2015 09:29
Show Gist options
  • Save software-mariodiana/6285873 to your computer and use it in GitHub Desktop.
Save software-mariodiana/6285873 to your computer and use it in GitHub Desktop.
Iterate through files in a folder and get the modification time for each INI file.
Set fso = CreateObject("Scripting.FileSystemObject")
Set theFolder = fso.GetFolder("C:\Windows")
Wscript.Echo "Directory:" & vbNewLine & theFolder.Path
Set theFiles = theFolder.Files
For Each aFile in theFiles
' Note: You have to use the File System Object!
If UCase(fso.GetExtensionName(aFile.Name)) = "INI" Then
Wscript.Echo "File:" & vbNewLine & aFile.Name
Wscript.Echo "Modified:" & vbNewLine & aFile.DateLastModified
Wscript.Echo "Days old: " & DateDiff("d", aFile.DateLastModified, Date)
End If
Next
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment