Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to create a list with filename and "Date Picture Taken"

Posted on 2008-09-30
11
Medium Priority
?
1,093 Views
Last Modified: 2012-06-27
Is there any simple method to export (create) a list with filename and "Date Picture Taken" within a directory?
0
Comment
Question by:Hoogendoorn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
11 Comments
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 22606438
Something like this maybe?

Just save it as a VBS in the directory you want to scan.
Option Explicit
Dim fso, objShell, objFolder, tFolder, tFile
Dim currentFolder
Set fso=CreateObject("scripting.filesystemobject")
currentFolder = fso.GetAbsolutePathName(".")&"\"
Set tFolder = fso.getfolder(CurrentFolder)
Set objShell = CreateObject ("Shell.Application") 
Set objFolder = objShell.Namespace(Currentfolder) 
 
For each tFile in tFolder.files
If UCase(FileExt(tFile.name)) = "JPG" Then
     wscript.echo objFolder.GetDetailsOf(objFolder.Parsename(tFile.name), 0) 
     wscript.echo objFolder.GetDetailsOf(objFolder.Parsename(tFile.name), 10) 
     wscript.echo objFolder.GetDetailsOf(objFolder.Parsename(tFile.name), 24) 
     wscript.echo objFolder.GetDetailsOf(objFolder.Parsename(tFile.name), 25) 
 
'Extended file properties:
'0 Name 
'1 Size 
'2 Type 
'3 Date Modified 
'4 Date Created 
'5 Date Accessed 
'6 Attributes 
'7 Status 
'8 Owner 
'9 Author 
'10 Title 
'11 Subject 
'12 Category 
'13 Pages 
'14 Comments 
'15 Copyright 
'16 Artist 
'17 Album Title 
'18 Year 
'19 Track Number 
'20 Genre 
'21 Duration 
'22 Bit Rate 
'23 Protected 
'24 Camera Model 
'25 Date Picture Taken 
'26 Dimensions 
'27 
'28 
'29 Episode Name 
'30 Program Description 
'31 
'32 Audio sample size 
'33 Audio sample rate 
'34 Channels 
'35 Company 
'36 Description 
'37 File Version 
'38 Product Name 
'39 Product Version 
'40 Keywords 
End If
 
Next
 
Set fso=Nothing
Set tFolder = Nothing
Set tFile = Nothing
Set objFolder = Nothing
 
Function FileExt(FileName)
FileExt = Right(FileName, Len(FileName)-instrrev(FileName,"."))
End Function

Open in new window

0
 

Author Comment

by:Hoogendoorn
ID: 22607471
Thanks for your effort, Brandon. Unfortunately, I am an 'old' guy, only familiar with Fortran programming. Could you make to the script so, that it saves the file properties (including filename) to a file?
0
 
LVL 50

Expert Comment

by:jcimarron
ID: 22607615
Hoogendoorn--Possibly Karens Directory Printer
http://www.karenware.com/powertools/ptdirprn.asp
Very configurable.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 750 total points
ID: 22607839
This will output to a file called PictureInfo.txt in the same directory.
Option Explicit
Dim fso, objShell, objFolder, tFolder, tFile, toWrite, outFile
Dim currentFolder
Set fso=CreateObject("scripting.filesystemobject")
currentFolder = fso.GetAbsolutePathName(".")&"\"
Set tFolder = fso.getfolder(CurrentFolder)
Set objShell = CreateObject ("Shell.Application") 
Set objFolder = objShell.Namespace(Currentfolder) 
Set outFile = fso.createtextFile(CurrentFolder & "PictureInfo.txt",1,1)
 
 
For each tFile in tFolder.files
If UCase(FileExt(tFile.name)) = "JPG" Then
     toWrite = "File Name:" & objFolder.GetDetailsOf(objFolder.Parsename(tFile.name), 0)  & ";" & _
               "Date Taken:" & objFolder.GetDetailsOf(objFolder.Parsename(tFile.name), 25)  & ";"
outFile.writeline toWrite
     
'Extended file properties:
'0 Name 
'1 Size 
'2 Type 
'3 Date Modified 
'4 Date Created 
'5 Date Accessed 
'6 Attributes 
'7 Status 
'8 Owner 
'9 Author 
'10 Title 
'11 Subject 
'12 Category 
'13 Pages 
'14 Comments 
'15 Copyright 
'16 Artist 
'17 Album Title 
'18 Year 
'19 Track Number 
'20 Genre 
'21 Duration 
'22 Bit Rate 
'23 Protected 
'24 Camera Model 
'25 Date Picture Taken 
'26 Dimensions 
'27 
'28 
'29 Episode Name 
'30 Program Description 
'31 
'32 Audio sample size 
'33 Audio sample rate 
'34 Channels 
'35 Company 
'36 Description 
'37 File Version 
'38 Product Name 
'39 Product Version 
'40 Keywords 
End If
 
Next
outFile.close
Set outFile=Nothing
Set fso=Nothing
Set tFolder = Nothing
Set tFile = Nothing
Set objFolder = Nothing
 
Function FileExt(FileName)
FileExt = Right(FileName, Len(FileName)-instrrev(FileName,"."))
End Function

Open in new window

0
 

Author Comment

by:Hoogendoorn
ID: 22607899
Unfortunately Karen's Directory Printer does not cover JPG-attributes.
0
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 22607928
May want to change:

If UCase(FileExt(tFile.name)) = "JPG" Then

To:

If UCase(FileExt(tFile.name)) = "JPG" or UCase(FileExt(tFile.name)) = "JPEG" Then
0
 

Author Comment

by:Hoogendoorn
ID: 22607947
This seems OK, Brandon. One more request: is it also possible to add the seconds to the time?
0
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 22608144
If it's not there, then no.  Most camera's don't have the concept of seconds anyway.
0
 

Author Comment

by:Hoogendoorn
ID: 22608348
Mmmm, when I look in File Info in Adobe Photoshop Elements the seconds are also displayed, so they should be there.
0
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 22608558
"If it's not there"

obviously  shell.application.Namespace.GetDetailsOf doesn't display that though.
0
 

Author Comment

by:Hoogendoorn
ID: 22608590
Well, that's a pitty. Anyway, I accept the second VBS you supplied as solution. Tanks.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are 2 things you must have in order to connect to the internet behind a router, The "Gateway IP" of the router, which is usually something like 192.168.xxx.1, I've seen routers with default values of: 192.168.0.1, 192.168.1.1, 192.168.11.1, …
Can you find a fax from a vendor you saved a decade ago in seconds? Have you ever cursed your PC under your breath during an audit because you couldn’t find the requested statement or driver history?  If you answered no to the first question or yes …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question