VBScript get picture date taken
January 25, 2008 by leereid
So I wanted to find something to let me rename the pictures in a folder to include the date they were taken. Being a fond reader of Hey, Scripting Guy!, I looked there first, but their suggestion requires Desktop Search and I wanted a solution that didn’t require it. Some web searching led me to come up with the script below. The first snippet will give you the info you’re after, you can manipulate it, the commented out section will give you a bunch of other fields you can query.
sFolderPathspec = “X:\Image\location\Folder”Set objShell = CreateObject (“Shell.Application”)Set objFolder = objShell.Namespace(sFolderPathspec)
Dim arrHeaders(40)
For Each strFileName In objFolder.Items
WScript.Echo objFolder.GetDetailsOf(strFileName, 0) & vbTab & objFolder.GetDetailsOf(strFileName, 25)
Next
’sFolderPathspec = “X:\Image\location\Folder”
‘Set objShell = CreateObject (“Shell.Application”)
‘Set objFolder = objShell.Namespace(sFolderPathspec)
‘Dim arrHeaders(40)
‘
‘For i = 0 to 40
‘ arrHeaders(i) = i & ” ” & objFolder.GetDetailsOf(objFolder.Items, i) ‘Next ‘wsh.echo join(arrHeaders, vbNewline)
‘ For Each strFileName In objFolder.Items
‘ For i = 0 To 40
‘ WScript.Echo i & vbTab & arrHeaders(i) & “: ” & objFolder.GetDetailsOf(strFileName, i)
‘ Next
‘ Next
Posted in VBScript | 2 Comments
Leave a Reply
Thanks, this was just what I was looking for!
Good job!
I too read the Scripting Guys version and didnt like the idea of having to install Desktop Search, so I kept looking untill I came across your version.
Thanks,