看你也是动手动脑一天了,没人帮我来#include <File.au3>
Local $aFile, $nMax = 5 ;最大数量
Local $sWNList = '浏览器.lnk|qq.lnk|xxx.lnk' ;白名单,|间隔
Local $nNow, $ExitFlag
Local $hTimer = TimerInit()
Local $sPath = @DesktopDir & '\if\BackUp'
Local $s_WNList = StringRegExpReplace($sWNList, '[.+\-(){}[\]^$]', '\\$0')
While 1
$aFile = _FileListToArray($sPath)
If Not @error Then
If $aFile[0] > $nMax Then
$nNow = 0
For $ii = 1 To $aFile[0]
If Not StringRegExp($aFile[$ii], '(?:' & $s_WNList & ')') Then
$nNow += 1
If $nNow > $nMax Then
$ExitFlag = 1
MsgBox(64, '超出', '当前已超出,删除:' & $sPath & '\' & $aFile[$ii])
;~ FileDelete($sPath & '\' & $aFile[$ii]) ;删除
EndIf
EndIf
Next
If $ExitFlag Then
MsgBox(0, '', '删除完毕,退出')
ExitLoop
EndIf
EndIf
EndIf
If TimerDiff($hTimer) >= 60000 * 3 Then
MsgBox(0, '', '时间已到,退出')
ExitLoop
EndIf
Sleep(1000)
WEnd
Exit
|