#include #include #include Global $hGUI = GUICreate("File list is running", 800, 150) $Label_0 = GUICtrlCreateLabel("Output Diff File: C:\temp\diff.txt", 30, 10, 700, 20) $Label_2 = GUICtrlCreateLabel("Watchfolder:", 30, 40, 100, 20) $Input_1 = GUICtrlCreateInput("", 100, 40, 690, 20) $Label_1 = GUICtrlCreateLabel("Status: Please enter Folder", 30, 70, 700, 20) $Label_4 = GUICtrlCreateLabel("Last Diff: ", 30, 100, 400, 20) GUISetState(@SW_SHOW) Local $last_list = "" Local $out_file = "C:\temp\diff.txt" AdlibRegister("closeFunc", 100) AdlibRegister("listFilesFunc", 1000) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func listFilesFunc() Local $watchfolder = GUICtrlRead($Input_1) IF NOT ($watchfolder <> "") Then return EndIf GUICtrlSetData($Label_1, "Watching [" &$watchfolder & "] Last Cycle: " & _Now()) Local $new_list = _UpdateModifiedList($watchfolder,"*",0,False) IF $last_list <> $new_list THEN _WriteDateOfDataReviewToLog($out_file, " [" & $watchfolder & "] New Content: " & $new_list) GUICtrlSetData($Label_4, "Last Diff: " & _Now()) $last_list = $new_list ENDIF EndFunc Func _UpdateModifiedList($sPath, $sPattern = '*', $iReturn = 0, $bArray = False) Local $s_return_string, $s_file Local $h_search = FileFindFirstFile($sPath & '\' & $sPattern) Local $s_flist Do $s_file = FileFindNextFile($h_search) If $s_file <> '' Then $s_flist &= $s_file & '|' If $iReturn = 0 Then $s_return_string &= "[Name:" &$s_file $s_return_string &= "|Date:"&FileGetTime($sPath & '\' & $s_file, 0, 1) $s_return_string &= "|Size:"&FileGetSize($sPath & '\' & $s_file) & "]" EndIf $s_return_string &= '|' EndIf Until $s_file = '' FileClose($h_search) $s_return_string = StringRegExpReplace($s_return_string, '\|$', '') If $bArray Then $s_flist = StringTrimRight($s_flist, 1) Local $a = [$s_return_string, $s_flist] Return $a EndIf Return $s_return_string EndFunc Func _WriteDateOfDataReviewToLog($sFileName,$to_write) local $sWriteOption If FileExists($sFileName) Then $sWriteOption = $FO_APPEND Else $sWriteOption = $FO_OVERWRITE EndIf Local $hFilehandle = FileOpen($sFileName, $sWriteOption) Local $sLogEntry = _Now() & $to_write & @CRLF FileWrite($hFilehandle, $sLogEntry) FileClose($hFilehandle) EndFunc