bobski1
Programmer
- Aug 17, 2006
- 2
How can I get file attributes of MP3 files (AlbumTitle, Artist, Genre, etc)?
I am using the following code and only get the main file attributes such as: name, size, Type, date created,
date last accessed, and date last modified. The music attributes print as blank. I did turn on these music attributes in the directory view details and did see that there was information in these attribute fields. Can you please help with some sample code.
Sub Main
On Error GoTo Err_1
'***** Read files from selected folder (Directory) *****
Set fs = CreateObject("Scripting.FileSystemObject")
Set dirfolder = fs.GetFolder("E:\_Music\mp3\Enigma\The Cross Of Changes\")
'***** Read files *****
For Each fl In dirfolder.Files
aName = fl.name
aSize = Format(Int(fl.Size / 1024) + 1, "###,###,### KB")
aType = fl.type
aDC = Format(fl.DateCreated, "mm/dd/yyyy")
aDLA = Format(fl.DateLastAccessed, "mm/dd/yyyy")
aDLM = Format(fl.DateLastModified, "mm/dd/yyyy")
aTitle = fl.title
aArtist = fl.Artist
aAlbumTitle = fl.AlbumTitle
aGenre = fl.Genre
MsgBox ":" & aName & ":" & vbCrLf _
& ":" & aSize & ":" & vbCrLf _
& ":" & aType & ":" & vbCrLf _
& ":" & aDC & ":" & vbCrLf _
& ":" & aDLA & ":" & vbCrLf _
& ":" & aDLM & ":" & vbCrLf _
& ":" & aTitle & ":" & vbCrLf _
& ":" & aArtist & ":" & vbCrLf _
& ":" & aAlbumTitle & ":" & vbCrLf _
& ":" & aGenre & ":" & vbCrLf
Next fl
'On Error GoTo Err_1
Exit_1:
Exit Sub
Err_1:
MsgBox "********** In Subroutine Main ********** " & vbCrLf & vbCrLf & Error$
Resume Exit_1
End Sub
I am using the following code and only get the main file attributes such as: name, size, Type, date created,
date last accessed, and date last modified. The music attributes print as blank. I did turn on these music attributes in the directory view details and did see that there was information in these attribute fields. Can you please help with some sample code.
Sub Main
On Error GoTo Err_1
'***** Read files from selected folder (Directory) *****
Set fs = CreateObject("Scripting.FileSystemObject")
Set dirfolder = fs.GetFolder("E:\_Music\mp3\Enigma\The Cross Of Changes\")
'***** Read files *****
For Each fl In dirfolder.Files
aName = fl.name
aSize = Format(Int(fl.Size / 1024) + 1, "###,###,### KB")
aType = fl.type
aDC = Format(fl.DateCreated, "mm/dd/yyyy")
aDLA = Format(fl.DateLastAccessed, "mm/dd/yyyy")
aDLM = Format(fl.DateLastModified, "mm/dd/yyyy")
aTitle = fl.title
aArtist = fl.Artist
aAlbumTitle = fl.AlbumTitle
aGenre = fl.Genre
MsgBox ":" & aName & ":" & vbCrLf _
& ":" & aSize & ":" & vbCrLf _
& ":" & aType & ":" & vbCrLf _
& ":" & aDC & ":" & vbCrLf _
& ":" & aDLA & ":" & vbCrLf _
& ":" & aDLM & ":" & vbCrLf _
& ":" & aTitle & ":" & vbCrLf _
& ":" & aArtist & ":" & vbCrLf _
& ":" & aAlbumTitle & ":" & vbCrLf _
& ":" & aGenre & ":" & vbCrLf
Next fl
'On Error GoTo Err_1
Exit_1:
Exit Sub
Err_1:
MsgBox "********** In Subroutine Main ********** " & vbCrLf & vbCrLf & Error$
Resume Exit_1
End Sub