找回密码
 加入
搜索
查看: 1279|回复: 0

[AU3基础] 为什么不能复制整个目录下的文件呢?

[复制链接]
发表于 2010-10-29 09:31:35 | 显示全部楼层 |阅读模式
Dim $Files, $Size, $First = 0
_DirCopy("C:\Documents and Settings\Administrator", "d:\Drivers");要复制的文件夹

Func _DirCopy($Source, $Dest)
If Not FileExists($Dest) Then DirCreate($Dest)
If StringRight($Source, 1) = '\' Then $Source = StringTrimRight($Source, 1)
If StringRight($Dest, 1) <> '\' Then $Dest = $Dest & "\"
If $First = 0 Then
  $Size = DirGetSize($Source, 1)
  $Files = $Size[1]
  ProgressOn("复制目录", "正在拷贝文件夹...") ;开启进度条,此处可以换成其他控件
  $First = 1
EndIf
Dim $Search = FileFindFirstFile($Source & "\*.*")
While 1
  Dim $File = FileFindNextFile($Search)
  If @error Then ExitLoop
  If FileGetAttrib($Source & "\" & $File) <> "D" Then
   $Files -= 1
   Dim $Percent = 100 - ($Files / $Size[1] * 100)
   FileCopy($Source & "\" & $File, $Dest & $File, 1)
   ProgressSet(Int($Percent), "进度: " & Int($Percent) & "%" & "  正在拷贝:" & $File)
  Else
   _DirCopy($Source & "\" & $File, $Dest & $File)
  EndIf
WEnd
FileClose($Search)
Sleep(1000)
Exit
EndFunc   ;==>_DirCopy
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-21 19:49 , Processed in 0.077868 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表