以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  CopyFile怎么判断是否复制成功呢  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=170920)

--  作者:cd_tdh
--  发布时间:2021/8/11 14:45:00
--  CopyFile怎么判断是否复制成功呢
 CopyFile怎么判断是否复制成功呢

FileSys.CopyFile("C:\\TestFiles\\test.txt", "C:\\TestFiles2\\mytest.txt",True)


--  作者:有点蓝
--  发布时间:2021/8/11 14:55:00
--  
正常不出错就是成功了
--  作者:cd_tdh
--  发布时间:2021/8/11 15:03:00
--  

老师,百度了一下,这样就可以,判断目标目录是否有这个文件,有就成功,没有就失败,如果是大文件,能都显示系统内置的复制进度呢?

Dim jc
jc = CreateObject("Scripting.FileSystemObject").CopyFile("D:\\foxtable\\Development\\Code.mdb","G:\\0软件开发\\0狐表软件\\Code.mdb")
If CreateObject("Scripting.FileSystemObject").FileExists("G:\\0软件开发\\0狐表软件\\Code.mdb") Then \'单个文件名,对于*.*应该逐个判断.
    MessageBox.Show("备份成功!","提示",MessageBoxButtons.OK,MessageBoxIcon.None)
Else
    MessageBox.Show("备份失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.None)
End If


--  作者:有点蓝
--  发布时间:2021/8/11 15:05:00
--  
判断文件是否存在参考:http://www.foxtable.com/webhelp/topics/0331.htm

无法显示进度,可以使用这种模拟一下:http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=152101