VB或EXCEL如何提取文件夹中每个文件的创建日期和修改日期;有没有方法能够提取目标文件夹下面的子文件夹名
1个回答
展开全部
Sub xxx()
On Error Resume Next
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("c:\")' "c:\"换成你的路径
Set fc = f.Files
tmp = "文件名" & vbTab & "创建时间" & vbTab & "修改时间" & vbTab & "访问时间" & vbTab & "文件类型" & vbTab & "文件类型" & vbLf
For Each file In fc
tmp = tmp & file.Name & vbTab & file.DateCreated & vbTab & file.DateLastModified & vbTab & file.DateLastAccessed & vbTab & file.Size / 1024 & "KB" & vbTab & file.Type & vbLf
Next
Set fc = f.Subfolders
For Each file In fc
tmp = tmp & file.Name & vbTab & file.DateCreated & vbTab & file.DateLastModified & vbTab & file.DateLastAccessed & vbTab & file.Size / 1024 & "KB" & vbTab & file.Type & vbLf
Next
MsgBox tmp
End Sub
On Error Resume Next
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("c:\")' "c:\"换成你的路径
Set fc = f.Files
tmp = "文件名" & vbTab & "创建时间" & vbTab & "修改时间" & vbTab & "访问时间" & vbTab & "文件类型" & vbTab & "文件类型" & vbLf
For Each file In fc
tmp = tmp & file.Name & vbTab & file.DateCreated & vbTab & file.DateLastModified & vbTab & file.DateLastAccessed & vbTab & file.Size / 1024 & "KB" & vbTab & file.Type & vbLf
Next
Set fc = f.Subfolders
For Each file In fc
tmp = tmp & file.Name & vbTab & file.DateCreated & vbTab & file.DateLastModified & vbTab & file.DateLastAccessed & vbTab & file.Size / 1024 & "KB" & vbTab & file.Type & vbLf
Next
MsgBox tmp
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询