;8 это чтобы создать папку если не существует, 1 это перезапись файлов
$iRet = _File_xCopy(@ScriptDir & "\Source", @ScriptDir & "\Dest", "(*.exe|*.vdb|*.dwl|*.dll)", "", 8+1, 1)
$iExtended = @extended
$iError = @error
MsgBox(64, "Results", StringFormat("ERROR:\t\t%i\nReturn:\t\t%i\nFiles Copied:\t%i", $iError, $iRet, $iExtended))
Func _File_xCopy($sSrc_Dir, $sDst_Dir, $sFile_Filter, $sFile_Prefix="", $iReplace=0, $iOnlyNew=0)
If Not StringInStr(FileGetAttrib($sSrc_Dir), "D") Then Return SetError(1, 0, 0)
Local $iRet_Extended = 0, $sRegExp_Filter, $hSearch, $sFile_Path, $sFile_Name
Local $iSrc_FileTime, $iDst_FileTime
$sSrc_Dir = StringRegExpReplace($sSrc_Dir, "\\+$", "")
$sDst_Dir = StringRegExpReplace($sDst_Dir, "\\+$", "")
$sRegExp_Filter = $sFile_Filter
$sRegExp_Filter = StringReplace($sRegExp_Filter, ".", "\.")
$sRegExp_Filter = "(?i)\A" & StringReplace($sRegExp_Filter, "*", ".*") & "\z"
$hSearch = FileFindFirstFile($sSrc_Dir & "\*")
While 1
$sFile_Name = FileFindNextFile($hSearch)
If @error Then ExitLoop
$sFile_Path = $sSrc_Dir & "\" & $sFile_Name
If StringInStr(FileGetAttrib($sFile_Path), "D") > 0 Then
_File_xCopy($sFile_Path, $sDst_Dir & "\" & $sFile_Name, $sFile_Filter, $sFile_Prefix, $iReplace, $iOnlyNew)
$iRet_Extended += @extended
Else
If StringRegExp($sFile_Name, $sRegExp_Filter) Then
If $iOnlyNew = 1 Then
$iSrc_FileTime = FileGetTime($sFile_Path, 0, 1)
$iDst_FileTime = FileGetTime($sDst_Dir & "\" & $sFile_Prefix & $sFile_Name, 0, 1)
If $iSrc_FileTime <= $iDst_FileTime Then ContinueLoop
EndIf
$iRet_Extended += FileCopy($sFile_Path, $sDst_Dir & "\" & $sFile_Prefix & $sFile_Name, $iReplace)
EndIf
EndIf
WEnd
Return SetExtended($iRet_Extended, FileClose($hSearch))
EndFunc