#include <File.au3>
Local $sDir = @ScriptDir & '\test\' ;测试文件夹
Local $aFLs = _FileListToArray($sDir, '*_iis_log.txt', 1)
If @error Then Exit MsgBox(48, '', '未发现 *_iis_log.txt 文件')
Local $iFile = '', $FileName = '', $nTotal = 0, $sInfo = ''
For $i = 1 To $aFLs[0]
$iFile = StringRegExpReplace($aFLs[$i], '^(\d+).*', '$1')
$FileName = StringRegExpReplace(FileRead($sDir & $aFLs[$i]), '^.+\n.+?\\([^\\\v]+)(?:\r|$).*', '$1')
If FileMove($sDir & $iFile & '.zip', $sDir & $FileName) Then
$nTotal += 1
$sInfo &= $sDir & $iFile & '.zip ---> ' & $sDir & $FileName & @CRLF
EndIf
Next
MsgBox(64, '完成 ' & $nTotal & ' 组', $sInfo)
|