添加一个FileListBox控件,用来提取文件夹中所有的文件;
设置好源文件和目标文件路径,用FileCopy复制文件。
代码如下:
Option Explicit
Private Sub Form_Load()
File1.Path = "D:\a"
End Sub
Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
Dim N As Integer
Dim oldPath As String
Dim newPath() As String
oldPath = "D:\a"
N = 4
ReDim newPath(1 To N)
For i = 1 To N
newPath(i) = "E:\" & i
Next
For i = 1 To N
For j = 0 To File1.ListCount - 1
FileSystem.FileCopy oldPath & "\" & File1.List(j), newPath(i) & "\" & File1.List(j)
Next
Next
End Sub