Last active
September 15, 2015 23:37
-
-
Save mmmurf/64dfdc5125eb1a289951 to your computer and use it in GitHub Desktop.
script to fix the created datestamp on files rescued from snapjoy's end of life backup downloads. This makes them show up in the proper order in Carousel
This file contains 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
# this script fixed the ordering in carousel of may snapjoy files. | |
# works on OSX | |
require 'date' | |
Dir.glob("./**/*.jpeg").each do |f| | |
next if f =~ /nknown/ | |
m = /(?<serial>\d{0,6})-(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/.match(f) | |
d = DateTime.new(m['year'].to_i, m['month'].to_i, m['day'].to_i) + Rational(m['serial'].to_i, 86400) | |
fdate = d.strftime("%m/%d/%Y %H:%M:%S") | |
cmd = %Q{SetFile -d '#{fdate}' #{f}} | |
puts cmd | |
puts %x[#{cmd}] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment