It prompts for a time in weeks and a base folder and then prints out whether the folder has been modified or not within that timescale.
It should be run with cscript and will print out a simple list of folder name and either "modified" or "unmodified".
'-------------------------------
Option Explicit
Dim iWeeksCutoff, oFSO, oBaseFolder, cFolders, oFolder, bExit
iWeeksCutoff = cInt(InputBox("Enter weeks of inactivity ",,"26"))
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oBaseFolder = oFSO.GetFolder(inputbox("Enter disk or folder to check"))
Set cFolders = oBaseFolder.Subfolders
For Each oFolder in cFolders
bExit = False
CheckFolder oFolder
If bExit Then
wscript.echo oFolder.Name & vbtab & "Modified"
Else
wscript.echo oFolder.Name & vbtab & "Unmodified"
End If
Next
Set cFolders = Nothing
Set oFSO = Nothing
wscript.quit(0)
' ------------------------
Sub CheckFolder(oCFolder)
Dim cFiles, oFile, dtModify, iFileAge, oSubFolder
If bExit Then Exit Sub
Set cFiles = oCFolder.Files
For Each oFile in cFiles
dtModify = FormatDateTime(oFile.DateLastModified, vbShortdate)
iFileAge = cInt(Datediff("WW", dtModify, Now))
If iFileAge < iWeeksCutoff Then
bExit = True
Exit Sub
End If
Next
For Each oSubfolder in oCFolder.SubFolders
CheckFolder oSubfolder
Next
End Sub
'-------------------------
Now if you want to make Old Mycroft happy - less grumpy? - replace line 38 oFile.DateLastModified with oFile.DateLastAccessed and his world will be all sparkly.
Neil :)