liste 10000 jpg filers metadata i excel - hvornår er billedet faktisk taget
Hej,Jeg vil gerne traversere 10.000 billeder i en mappestruktur og skrive én linje pr. billede i excel.
Min udfordring er at jeg ikke kan finde den rigtige dato - nedenstående finder ikke billedets optagelsesdato - kan jeg spørge på denne fil-egenskab, istedet for datecreated og datelastmodified.
Konkret får jeg billedet identificeret ift. hvornår det er lagt over på computeren, - jeg ønsker timestamp fra cameraet som tidspunkt.
Det er disse to linjer jeg gerne vil have udskiftet med noget der finder de rigtige JPG-metadata:
Range("destination").Offset(i, 2) = .DateCreated
Range("destination").Offset(i, 3) = .datelastmodified
------------------------------
Sub FindAndWriteJPGFilesInExcel()
Const cFile = "*.jp*"
Dim i As Long, rng As Range, wkb As Workbook
Dim strFile As String, lngStartLine As Long, lngStartCol As Long
Dim xCalc As XlCalculation, blnEvents As Boolean
Dim cFolder As String ' cell containing path to be searched
Dim myFSO, myFileObject
cFolder = Range("Source")
Set myFSO = CreateObject("Scripting.FileSystemObject")
With Application.FileSearch
.NewSearch
.LookIn = cFolder
.Filename = cFile
.SearchSubFolders = Range("searchsubfolders").Value ' At test run i did not want to include the whole tree
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
If .Execute() > 0 Then
'On Error GoTo errwkb
For i = 1 To .FoundFiles.Count
Application.ScreenUpdating = False
Set myFileObject = myFSO.GetFile(.FoundFiles(i))
With myFileObject
Range("destination").Offset(i, 1) = .Name
Range("destination").Offset(i, 2) = .DateCreated
Range("destination").Offset(i, 3) = .datelastmodified
Range("destination").Offset(i, 4) = .Path
Range("destination").Offset(i, 5) = .Size
End With
Set myFileObject = Nothing
If (i Mod 1000 = 0) Then
MsgBox i ' this line I put a break mark on, since the code slowed my PC down, then for every 1000 pics i regained CPU control
End If
Debug.Print i
Next i
Application.ScreenUpdating = True
End If
End With
End Sub
