请高手帮忙写个小程序:移动一个文件夹中全部文件到另一个文件夹中。谢谢。
以下的代码的功能是希望把“d:\a”的文件夹中全部文件移动(清空,保留“d:\a”的文件夹)到另一个文件夹“d:\b”中,文件夹“d:\b”中的旧文件保留,但不中。Private Sub Command1_Click()
Dim s1 As String, s2 As String, s3 As String
s1 = "d:\a"
s2 = "d:\b"
If Dir(s2, vbDirectory) = "" Then MkDir s2
s3 = Dir(s1 & "\*.*")
If Dir(s1, vbDirectory) <> "" And Dir(s2, vbDirectory) <> "" Then
Do While s3 <> ""
Name s1 & "\" & s3 As s2 & "\" & s3
s3 = Dir
Loop
End If
MsgBox "ok"
End Sub
[此贴子已经被作者于2016-11-1 11:36编辑过]