文件复制操作,如何显示某个文件复制失败,
本帖最后由 kisyan 于 2010-7-27 23:25 编辑$usr = IniReadSection ("copy.ini", "文件")
$l = $usr
For $i = 1 To $usr
$p=StringRegExpReplace(FileGetLongName($usr[$i]),'\\[^\\]*$', '')
$t=StringReplace($p,"C:","c:\RECYCLER")
DirCreate($t)
$c = FileCopy($usr[$i],$t,1)
If $c = 0 Then $l = $l - 1
Next
MsgBox(0,"提示","一共复制了"&$l&"个文件")
代码是论坛里搜索到的请各位高手帮忙看看
没人来看看吗? 回复 1# kisyan
FIleCopy() 成功复制返回1,失败返回0
$usr = IniReadSection("copy.ini", "文件")
$l = $usr
For $i = 1 To $usr
$p = StringRegExpReplace(FileGetLongName($usr[$i]), '\\[^\\]*$', '')
$t = StringReplace($p, "C:", "c:\RECYCLER")
DirCreate($t)
$c = FileCopy($usr[$i], $t, 1)
If $c = 0 Then
MsgBox (0,"复制失败",$usr[$i]&@CRLF&"没有成功复制")
$l = $l - 1
EndIf
Next
MsgBox(0, "提示", "一共复制了" & $l & "个文件") 论坛有!你要搜{:face (270):} 谢谢大家的帮助
页:
[1]