我有使用此脚本的vbs脚本我能够从音频文件所在的文件夹中获取音频文件数据(路径,名称,大小(kb),类型,创建日期,上次访问日期,修改日期)但我也想要音频文件的长度,但我没有clu怎么做,请帮我修改这段代码。
Dim objFSO, startFolder, OlderThanDate
'Flags for files
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
' Flags for browse dialog
Const BIF_returnonlyfsdirs = &H0001
Const BIF_dontgobelowdomain = &H0002
Const BIF_statustext = &H0004
Const BIF_returnfsancestors = &H0008
Const BIF_editbox = &H0010
Const BIF_validate = &H0020
Const BIF_browseforcomputer = &H1000
Const BIF_browseforprinter = &H2000
Const BIF_browseincludefiles = &H4000
currentScriptPath = Replace(WScript.ScriptFullName, WScript.ScriptName, "")
reportFile = currentScriptPath & "FilePropertiesReport.csv"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objDlg = WScript.CreateObject("Shell.Application")
Set objShell = CreateObject("WScript.Shell")
' Use the BrowseForFolder method.
Set objStartFolder = objDlg.BrowseForFolder (&H0, _
"Select the folder you want to report on, su folder will also be reported", BIF_editbox + BIF_returnonlyfsdirs)
' Here we use TypeName to detect the result.
If InStr(1, TypeName(objStartFolder), "Folder") > 0 Then
startFolder = objStartFolder.ParentFolder.ParseName(objStartFolder.Title).Path
'Create report file and add CSV Header
Set objReportFile = objFSO.CreateTextFile(reportfile, ForWriting)
objReportFile.Write("Path, Name, Size (kb), Type, Date Created, Date Last Accessed, Date Laste Modified,Length" & chr(13) & chr(10))
'Run the function
ReportFiles startFolder
'Close the report
objReportFile.Close
'Ask to open the report now or just close
strMbox = MsgBox("Reporting Complete. " & chr(13) & chr(10) &"The report has been saved to: " & reportFile & chr(13) & chr(10) & chr(13) & chr(10) & "Would you like to open the report now?",4,"Open report now?")
if strMbox = 6 Then
objShell.Run reportFile
End if
Else
MsgBox "An error has occured."
End if
'----------------------------------------------
' Function
'----------------------------------------------
Function ReportFiles(folderName)
Dim objFolder, objFile, fileCollection, folderCollection, subFolder
Set objFolder = objFSO.GetFolder(folderName)
Set fileCollection = objFolder.Files
For Each objFile In fileCollection
strFilePath = chr(34) & objFile.Path & chr(34)
strFileName = chr(34) & objFile.Name & chr(34)
strFileSize = objFile.Size / 1024
strFileType = chr(34) & objFile.Type & chr(34)
strFileDateCreated = objFile.DateCreated
strFileDateLastAccessed = objFile.DateLastAccessed
strFileDateLastModified = objFile.DateLastModified
objReportFile.Write(strFilePath & "," & strFileName & "," & strFileSize & "," & strFileType & "," & strFileDateCreated & "," & strFileDateLastAccessed & "," & strFileDateLastModified & chr(13) & chr(10))
Next
'Loop for each sub folder
Set folderCollection = objFolder.SubFolders
For Each subFolder In folderCollection
ReportFiles subFolder.Path
Next
End Function