VB 关于批量复制文件的 请求帮助
说明: D:\AAA , D:\BBB , D盘下有2个文件夹,分别为 AAA,BBB,其中AAA文件夹下有10个TXT文件,文件夹BBB 为空文件夹
要求: 将 AAA 文件夹下的 10个TXT 文件复制到 文件夹BBB 下, 用COPY 语句不行,不知道错在哪里,请求老师指导,谢谢
Private Sub Command1_Click()
Copy D:\AAA\*.txt", "D:\BBB"
End Sub
[解决办法]
1,Copy 函数从何得来?没记错应该是filecopy 或者是
Set fso = CreateObject("Scripting.FileSystemObject")
fso.copy……
Dim SourceFile, DestinationFile As String, strFile As String
strFile = Dir("D:\AAA\*.txt")
Do Until strFile = ""
SourceFile = "D:\AAA" & strFile
DestinationFile = "D:\BBB" & strFile
FileCopy SourceFile, DestinationFile
strFile = Dir()
Loop
Dim strFile As String
strFile = Dir("D:\AAA\*.txt")
Do Until strFile = ""
Name "D:\AAA" & strFile As "D:\BBB" & strFile
strFile = Dir()
Loop