#include <File.au3>
#include <Array.au3>
#include <Date.au3>
$Dir = @ScriptDir ;被监视的文件夹
$a = _FileListToArray($Dir, '*', 2)
AdlibRegister('jc')
While 1
Sleep(1)
WEnd
Func jc()
$b = _FileListToArray($Dir, '*', 2)
$c = $b
$f = FileOpen('记录.log', 1)
$t = _Now() & ' ==> '
For $i = 1 To $a[0]
$ss = _ArraySearch($c, $a[$i])
If $ss = -1 Then
FileWriteLine($f, $t & '文件夹 "' & $a[$i] & '" 已被删除')
Else
_ArrayDelete($c, $ss)
EndIf
Next
If UBound($c) > 1 Then
For $i = 1 To UBound($c) - 1
FileWriteLine($f, $t & '文件夹 "' & $c[$i] & '" 已被创建')
Next
EndIf
FileClose($f)
$a = $b
EndFunc ;==>jc
|