#Include <FileOperations.au3>
_deldub_arch()
Func _deldub_arch()
Local $sPath, $aProgiFull, $a
$sPath = 'd:\TC\Update\'
$aProgiFull = _FO_FileSearch($sPath, '*,exe|*.rar|*.zip', True, 0, 1, 1, 1, '', '', '')
Dim $aTableProgi[UBound($aProgiFull)][3]
For $i=1 To $aProgiFull[0]
$aTableProgi[$i][0] = StringRegExpReplace ($aProgiFull[$i],'(?m)(^.*)\\(.*)$','\2')
$aTableProgi[$i][1] = StringRegExpReplace ($aTableProgi[$i][0],'(.+)\_([\d+\.]+)(\_.+)?(\.zip|\.rar)','\1')
$aTableProgi[$i][2] = StringRegExpReplace ($aTableProgi[$i][0],'(.+)\_([\d+\.]+)(\_.+)?(\.zip|\.rar)','\2')
Next
For $i=1 To UBound($aTableProgi)
If $i = UBound($aTableProgi) - 1 Then ExitLoop
If $aTableProgi[$i][1] = $aTableProgi[$i+1][1] Then
MsgBox(4096,'Дубликаты', 'Найдены дубликаты в строках '&$i &' и '&$i+1 )
If $aTableProgi[$i][2] > $aTableProgi[$i+1][2] Then
$a &= $sPath&$aTableProgi[$i+1][0]&'|'
Else
$a &= $sPath&$aTableProgi[$i][0]&'|'
EndIf
EndIf
Next
$a = StringTrimRight($a, 1)
FileDelete ($a)
EndFunc