I have a folder filled with screenshots from World of Warcraft and I have lost the original date stamps (date created metadata).
The good news is that all files is named systematically with dates
WoWScrnShot_123109_224259.jpg
WoWScrnShot_092510_213950.jpeg
WoWScrnShot_041813_183548.tga
WoWScrnShot_011315_132530.png
So it's WoWScrnShot_MMDDYY_HHMMSS.filetype
I want a script that loops through all the pictures in my screenshots folder and set the meta data accordingly.
Note: the files are in jpg/jpeg/tga/png
This is a really ugly bash-script that I wrote a while back for the exact same purpose that I just modified a little so it will work on OS X. Hope it works for you.
#!/bin/bash
FILES=/Path/To/Screenshots/*
for f in $FILES
do
month="$(echo $f | sed 's/\.[^.]*$//' | awk '{gsub("/Path/To/Screenshots/WoWScrnShot_", "");print}' | awk '{print substr($0,0,2)}')"
day="$(echo $f | sed 's/\.[^.]*$//' | awk '{gsub("/Path/To/Screenshots/WoWScrnShot_", "");print}' | awk '{print substr($0,3,2)}')"
year="$(echo $f | sed 's/\.[^.]*$//' | awk '{gsub("/Path/To/Screenshots/WoWScrnShot_", "");print}' | awk '{print substr($0,5,2)}')"
hour="$(echo $f | sed 's/\.[^.]*$//' | awk '{gsub("/Path/To/Screenshots/WoWScrnShot_", "");print}' | awk '{print substr($0,8,2)}')"
minute="$(echo $f | sed 's/\.[^.]*$//' | awk '{gsub("/Path/To/Screenshots/WoWScrnShot_", "");print}' | awk '{print substr($0,10,2)}')"
second="$(echo $f | sed 's/\.[^.]*$//' | awk '{gsub("/Path/To/Screenshots/WoWScrnShot_", "");print}' | awk '{print substr($0,12,2)}')"
echo $f
SetFile -d "$month/$day/$year $hour:$minute:$second" $f
SetFile -m "$month/$day/$year $hour:$minute:$second" $f
done