Skip to content

Instantly share code, notes, and snippets.

@mmmurf
Last active September 15, 2015 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmmurf/64dfdc5125eb1a289951 to your computer and use it in GitHub Desktop.
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 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