Crazyredhead
New Member
- Joined
- Mar 23, 2021
- Messages
- 5
- Office Version
- 2010
- Platform
- Windows
Guys, I have the following piece of code, snaffled from here (thankyou to Domenic, by the way), which actually now does what I want it to, but "manually" - I have to enter the desired path, etc., in Range A1 on sheet1.
Great for one odd folder, BUT I've been tasked with creating a list, on one spreadsheet, with all this information but for every folder and subfolder in a given area (for example G:\Users\P\Music\Music).
There are some 70,000 files, spread across numerous (3258!) folders - one for each album - and there's no way I can change this as the data concerned has been copied to four different computers for a degree of resilience.
Purpose of the spreadsheet is to allow comparision of the music files held on each machine, to identify any missing tracks following a rebuild or reinstall of Windows (something that's had to be done on several occasions now to various machines).
I've found a routine to recursively loop through all the files and sub folders and list them in one sheet, but, of course, the additional metadata I need is not there - I can only get the file size.
Can anyone assist, please? It sounds like such a simple query, but I can't fathom it out for the life of me - clearly, I lack the necessary VBA skills and training to work this out (I have no "formal" training, I just dabble and, eventually, it works!)
My ideal is to have all this information on one sheet. Can anyone help? Many thanks in advance if you can!
code snippet:
Great for one odd folder, BUT I've been tasked with creating a list, on one spreadsheet, with all this information but for every folder and subfolder in a given area (for example G:\Users\P\Music\Music).
There are some 70,000 files, spread across numerous (3258!) folders - one for each album - and there's no way I can change this as the data concerned has been copied to four different computers for a degree of resilience.
Purpose of the spreadsheet is to allow comparision of the music files held on each machine, to identify any missing tracks following a rebuild or reinstall of Windows (something that's had to be done on several occasions now to various machines).
I've found a routine to recursively loop through all the files and sub folders and list them in one sheet, but, of course, the additional metadata I need is not there - I can only get the file size.
Can anyone assist, please? It sounds like such a simple query, but I can't fathom it out for the life of me - clearly, I lack the necessary VBA skills and training to work this out (I have no "formal" training, I just dabble and, eventually, it works!)
My ideal is to have all this information on one sheet. Can anyone help? Many thanks in advance if you can!
code snippet:
VBA Code:
Sub GetMetaDataFromSoundFiles()
Dim objShellApp As Object
Dim objFolder As Object
Dim varColumns As Variant
Dim arrData() As Variant
Dim wksResults As Worksheet
Dim strPath As String
Dim strFilename As String
Dim fileCount As Long
Dim i As Long
Dim j As Long
strPath = ThisWorkbook.Worksheets("Sheet1").Range("A1").Value
Set objShellApp = CreateObject("Shell.Application")
On Error Resume Next
Set objFolder = objShellApp.Namespace(CStr(strPath))
If objFolder Is Nothing Then
MsgBox "Folder not found!", vbExclamation, "Folder?"
Set objShellApp = Nothing
Exit Sub
End If
On Error GoTo 0
varColumns = Array(192, 191, 13, 21, 243, 16, 14, 27, 1)
ReDim arrData(0 To UBound(varColumns), 0 To objFolder.Items.Count)
For i = LBound(arrData, 1) To UBound(arrData, 1)
arrData(i, 0) = objFolder.GetDetailsOf(objFolder.Items, varColumns(i))
Next i
fileCount = 0
Last edited by a moderator: