;; 
;;=====================================================================================----- 
;; 
;;FUNCTION       FolderModCheck() 
;; 
;;ACTION         Determines if any changes were made to a folder structure 
;; 
;;AUTHOR         Glenn Barnas 
;; 
;;VERSION        1.0  - 2009/02/24 
;; 
;;HISTORY        1.0  - 2009/02/24 - Initial Release 
;; 
;;SYNTAX         FolderModCheck(Root, Datestamp [, Exclude]) 
;; 
;;PARAMETERS     Root - REQUIRED - String 
;;               - The path to the root of a folder structure. Returns true if any files  
;;               or folders below this path were modified since the supplied datestamp. 
;; 
;;               DateStamp - REQUIRED - Date String 
;;               - The date to compare against. Must be a string in the format 
;;               YYYY/MM/DD HH:MM - seconds are ignored in this comparison. 
;; 
;;		 Exclude - OPTIONAL - String 
;;               - A string of folder names that should be excluded. The 
;;		 string should be delimited with commas or spaces. 
;; 
;;REMARKS        Returns TRUE if any folder has a modified date newer than the timestamp 
;;		 provided. Modifying or deleting a file will update the folder timestamp, 
;;		 so checking the folder timestamps will speed processing significantly. 
;; 
;;RETURNS        1 if a folder has been modified after the Datestamp, 0 otherwise. 
;; 
;;DEPENDENCIES   TimeConvert(), DirList() 
;; 
;;TESTED WITH    W2K, WXP, W2K3, Vista, W2K8 
;; 
;;EXAMPLES       None 
; 
Function FolderModCheck($_Root, $_DateStamp, OPTIONAL $_ExcludeList)
 
  Dim $_Files, $_File					; Directory enumeration vars 
  Dim $_Last						; last update time 
  Dim $_Time						; folder mod time 
 
  ; If DateStamp is YYYY/MM/DD HH:MM:SS format, convert to cTime 
  If $_DateStamp <> 1 * Val($_DateStamp)
    $_DateStamp = TimeConvert($_DateStamp)
  EndIf
 
  ; If the root folder timestamp is modified (by modifying files in the root) then 
  ; return immediately. The root of drives (C:\ or \\server\share\) don't return 
  ; a time, so abbreviated processing cannot be done. 
  $_Time = GetFileTime($_Root)				; get the timestamp 
  If $_Time						; if it isn't null, process it. 
    $_Time = TimeConvert($_Time)			; start by checking the root folder 
    If $_Time - $_DateStamp > 0				; compare folder time and datestamp 
      $FolderModCheck = 1				; return immediatley if a modified folder is found 
      Exit 0
    EndIf
  EndIf
 
  ; Get a list of ALL folders in RootPath - check for modifications newer than the DateStamp value 
  ;  
  $_Files = DirList($_Root, 7)				; get list of every file/folder 
  For Each $_File in $_Files
    If Right($_File, 1) = '\' 				; check directories 
      $_File = Left($_File, Len($_File) - 1)		; trim the trailing slash 
    EndIf
    ; skip certain files/folders 
    If Not InStr($_ExcludeList, $_File)
      $_Time = TimeConvert(GetFileTime($_File))	; get folder mod time in cTime format  
      If $_Time - $_DateStamp > 0			; compare folder time and datestamp 
        $FolderModCheck = 1				; return immediatly if a modified folder is found 
        Exit 0
      EndIf
    EndIf
  Next
 
  $FolderModCheck = 0
  Exit 0
 
EndFunction