|
Sub Test()
Dim fso As Object, fld As Object, f As Object
Dim p As String, SourceFile As String, DestinationFile As String, ext As String
Dim i As Integer
p = "C:\DATA"
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.folderexists(p) Then
Set fld = fso.GetFolder(p) '得到文件夹对象 fld
For Each f In fld.Files
i = i + 1
SourceFile = p & "\" & f.Name ' 指定源文件名。
ext = fso.GetExtensionName(SourceFile)
DestinationFile = "D:\【工作记录】2016-05-03-第00" & i & "次保存." & ext ' 指定目的文件名。
FileCopy SourceFile, DestinationFile ' 将源文件的内容复制到目的文件中。
Next f
Else
MsgBox "无效路径"
End If
End Sub
工作记录2.rar
(13.46 KB, 下载次数: 14)
|
评分
-
查看全部评分
|