Thank you Skrommel, that's excellent. That loop is a bit tricky, I definitely wouldn't have been able to come up with it. I forgot about this ask till tonight and was excited to see your solution posted here when I arrived back at this thread. It also got me back looking into AHK scripting, I've really got to find the time to get into this more, it's such a great tool. I made a few tweaks and added an output listing and repost it here. Thanks again!
; 1/31/09 authored by Skrommel www.donationcoder.com/Software/Skrommel (Very Nice, Thank You!)
; 3/06/09 fhayes
; build and display list of changed dirs when program completes
; improved error handling
;MostRecent.ahk
; Set folder modifed date/time to most recently modified file it contains.
; user selects the top of the folder tree to be processed
; only files in the immediate folder being processed effect that folders timestamp decision
; all subfolder in the tree are processed as well
; To run, save this script as MostRecent.ahk, and install AutoHotkey from www.autohotkey.com.
;Skrommel @ 2009
#NoEnv
#SingleInstance,Force
FileSelectFolder,folder,*C:\,3,Select a folder to change the date/time of
if ErrorLevel
MsgBox,,,No folder selected,1
else
{
changelist := TRAVERSE(folder)
header = ** press Control-C to copy this text to the clipboard **`n`n
MsgBox,,List of updated directory timestamps,%header%%changelist%
}
Return
TRAVERSE(folder)
{
static filelist = ""
mostrecent=0
Loop,%folder%\*.*,1,0 ;include all files and folders, no recursion
{
IfInString,A_LoopFileAttrib,D ;is this a directory
childrecent:=TRAVERSE(A_LoopFileLongPath)
If (childrecent>mostrecent)
mostrecent:=childrecent
If (A_LoopFileTimeModified>mostrecent)
mostrecent:=A_LoopFileTimeModified
}
FileSetTime,%mostrecent%,%folder%,M,2,0 ;time modified,only folders,no recursion
FormatTime, TimeString, %mostrecent%, MM/dd/yyyy hh:mm tt
If (mostrecent<>0) ;if dir is not empty
filelist = %filelist%%TimeString%`t%folder%`n ;add to list
Return (filelist)
}