If Fso.Drives(Drive).IsReady = True Then Exit Do End If Loop If Fso.Drives(Drive).IsReady = False Then '6 秒后目标盘仍未准备就绪,退出 MsgBox " 目标驱动器 " & Drive & " 没有准备好! ", vbCritical Exit Sub End If If Fso.GetDrive(Drive).FreeSpace < Fso.GetFile(Filename).Size Then MsgBox "目标驱动器空间太小!", vbCritical '目标驱动器空间不够,退出 Exit Sub End If If Right(Drive, 1) <> ":" Then Drive = Drive & ":" End If If Left(Folder, 1) <> "\" Then Folder = "\" & Folder End If If Right(Folder, 1) <> "\" Then Folder = Folder & "\" End If Dest_path = Drive & Folder If Not Fso.FolderExists(Dest_path) Then '如果目标文件夹不存在,创建之 Fso.CreateFolder Dest_path End If Fso.CopyFile Filename, Dest_path & Fso.GetFileName(Filename), True '拷贝,直接覆盖同名文件 MsgBox " 文件备份完毕。", vbOKOnly Set Fso = Nothing End Sub Private Sub Waitfor(Delay As Single) '延时过程,Delay 单位约为 1 秒 Dim StartTime As Single StartTime = Timer Do Until (Timer - StartTime) > Delay Loop End Sub 作者信息: 张庆 Email:zhangking at 263.net QQ: 9365822 |
正在阅读:VB基础:认识VB的文件系统对象FSOVB基础:认识VB的文件系统对象FSO
2004-03-16 15:14
出处:CSDN
责任编辑:linjixiong
键盘也能翻页,试试“← →”键