给你做个例子,可用于整个目录复制,包含目录内的目录,复制时有复制进度的显示。#include <File.au3>
$dir = FileSelectFolder('选择目录:','')
If @error = 1 Then
MsgBox(48,"",'复制取消')
Exit
Else
$pathlen = StringLen($dir)
AdlibRegister('_prog')
ProgressOn('进度','复制中...')
$conf=_copy ($dir)
ProgressOff()
If $conf = 1 then
MsgBox(48,"",'复制完成!')
Else
MsgBox(48,"",'复制失败!')
EndIf
Exit
EndIf
Func _prog ()
$newsize = DirGetSize(@ScriptDir & '\scripts')/1024^2
$soursize = DirGetSize($dir)/1024^2
$prog = $newsize / $soursize * 100
ProgressSet($prog)
EndFunc
Func _copy($_Path)
$folder = _FileListToArray($_Path, "*", 0)
If Not IsArray($folder) Then Return 0
For $o = 1 To $folder[0]
_copy($_Path & "" & $folder[$o])
FileCopy ($_Path, @ScriptDir & '\scripts\'&StringTrimLeft($_Path,$pathlen)&"",9)
Next
Return 1
EndFunc
|