Created
December 15, 2014 16:23
-
-
Save watsonbox/fec4ed2a3ac7a4dfb998 to your computer and use it in GitHub Desktop.
Scans a folder of photos looking for save timestamps in XMP header
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
# | |
# Scans a folder of photos looking for save timestamps in XMP header | |
# | |
require 'nokogiri' | |
dir = ARGV[0] | |
Dir.foreach(dir) do |file| | |
next if file[0] == '.' | |
xmp = Nokogiri::XML(`exiftool -xmp -b "#{File.join(dir, file)}"`) | |
xmp = xmp.xpath( | |
"//x:xmpmeta/rdf:RDF/rdf:Description/xmpMM:History/rdf:Seq/rdf:li", | |
'xmpMM' => "http://ns.adobe.com/xap/1.0/mm/", | |
'x' => 'adobe:ns:meta/', | |
'rdf' => "http://www.w3.org/1999/02/22-rdf-syntax-ns#" | |
) | |
xmp.each do |element| | |
if element['stEvt:when'] | |
puts "#{file}, #{element['stEvt:when']}" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment