Local $sDir = @ScriptDir & '\300'
Local $aFile = _FileArray()
_FileBakCopy($sDir, $aFile)
Func _FileArray()
Local $a_File[4]
$a_File[1] = @ScriptDir & '\12\321.txt'
$a_File[2] = @ScriptDir & '\as\422.txt'
$a_File[3] = @ScriptDir & '\efd\523.txt'
Return $a_File
EndFunc ;==>_FileArray
Func _FileBakCopy($s_Dir, $a_File)
Local $sFN, $sBkDir = ''
For $i = 1 To UBound($a_File) - 1
$sFN = StringRegExpReplace($a_File[$i], '^.+\\', '')
If FileExists($s_Dir & '\' & $sFN) Then
If $sBkDir = '' Then $sBkDir = _CKCreateDir($s_Dir)
FileMove($s_Dir & '\' & $sFN, $sBkDir)
EndIf
FileCopy($a_File[$i], $s_Dir)
Next
EndFunc ;==>_FileBakCopy
Func _CKCreateDir($s_Dir)
Local $sDirIx = 1, $sDirNew = ''
While 1
$sDirNew = $s_Dir & '\' & StringFormat('%04d', $sDirIx)
If Not FileExists($sDirNew & '\') Then ExitLoop
$sDirIx += 1
WEnd
DirCreate($sDirNew)
Return $sDirNew
EndFunc ;==>_CKCreateDir
|