TransWikia.com

Changing Date on large numbers of scanned files

Photography Asked on February 14, 2021

I have thousands of scanned photos and would like to change the EXIF data to have the proper dates.
I can do this all with exiftool, but am looking for a way to process the files after I have organized the files into groups by date.

I created subfolders with the format mmddyy and placed each photo for that date within.

I would like a script to do the following (Windows based computer, so DOS, powershell, or VBscript would work):

Step through each folder, take the date from the folder and apply the following commands:

exiftool -datetimeoriginal="19yy:mm:dd 12:00:00" directory*.jpg
exiftool "-datetimeoriginal+<0:0:${filesequence;$_*=3}" directory*.jpg
move *.jpg e:Fixed

Any suggestions? I haven’t scripted in years and am definitely rusty.

One Answer

This can be done by exiftool without scripting. To set the time stamp, you could run
exiftool -ext jpg "-DateTimeOriginal<19${Directory;m/(dd)(dd)(dd)/;$_=$3$1$2} 12:00:00" /path/to/mmddyy/

Then the incrementing and moving of files can be done with
exiftool -ext jpg -Directory=e:Fixed -overwrite_original "-datetimeoriginal+<0:0:${filesequence;$_*=3}" /path/to/files/

The first command takes the directory, looks for 6 consecutive numbers which it assumes is the mmddyy, reorders them and applies the result to the DateTimeOriginal. Colon separators are not mandatory for this, see Exiftool FAQ #5, 3rd paragraph which starts "Having said this…". This command does require that the mmddyy part of the path is on the command line. You can't CD to the directory and use a dot as the directory name. If would also required refinement if there was another pattern of 6 consecutive digits somewhere else in the filepath.

The second command increments the time on each image. Additionally, it will move each edited file to the e:Fixed directory as it updates.

In both cases, I used the -ext (-extension) option rather than a wildcard, because wildcards won't work in case you have to recurse into subdirectories (see Common Mistake #2).

Answered by StarGeek on February 14, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP