Private Sub Command1_Click()
Dim CopySure As Long
Dim fso As New FileSystemObject
Dim file1 As Folder
Set fso = CreateObject("scripting.filesystemobject")
file2 = fso.MoveFolder("D:\Program Files\Microsoft SQL Server\MSSQL\log\", "e:\0018")
End Sub
运行是总是说我缺少函数或变量,错误停在movefolder那我是想把log这个文件夹 复制到e盘0018这个文件夹 大家提点意见
Dim CopySure As Long
Dim fso As New FileSystemObject
Dim file1 As Folder
Set fso = CreateObject("scripting.filesystemobject")
file2 = fso.MoveFolder("D:\Program Files\Microsoft SQL Server\MSSQL\log\", "e:\0018")
End Sub
运行是总是说我缺少函数或变量,错误停在movefolder那我是想把log这个文件夹 复制到e盘0018这个文件夹 大家提点意见
Private Sub Command1_Click()
Dim CopySure As Long
Dim fso As New FileSystemObject
Dim file1 As Folder
Set fso = CreateObject("scripting.filesystemobject")
fso.MoveFolder "D:\Program Files\Microsoft SQL Server\MSSQL\log\", "e:\0018"
End Sub
Dim CopySure As Long
Dim fso ' 去掉就行了,因为已经有createobject函数了
Dim file2
Dim file1 As Folder
Set fso = CreateObject("scripting.filesystemobject")
file2 = fso.MoveFolder("D:\test1", "d:\test\")
End Sub
说明
object.movefolder source,des
des如果以"\"结尾,则认为是一个存在的文件夹
否则,认为是一个要创建的文件夹
如果 destination 是一个已存在文件,则发生一个错误。
如果 destination 是一个目录,则发生一个错误。
如果 source 中使用的一个通配符不能和任何文件夹相匹配,也发生一个错误。MoveFolder 方法停止在它遇到的第一个错误上。不要尝试回卷在错误发生前所做的任何改变。重点 只有在操作系统支持的情况下,这个方法才允许文件夹在卷之间移动。
Private Sub Command1_Click()
Dim move
Set fso = CreateObject("Scripting.FileSystemObject")
move = fso.copyfolder("d:2", "e:\1")
MsgBox "移动更名成功"
fso.deletefolder ("d:\2")
MsgBox "删除成功"
End Sub