Created
September 18, 2013 13:25
-
-
Save matsu911/6609106 to your computer and use it in GitHub Desktop.
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
require 'digest/sha1' | |
require 'sqlite3' | |
def sha1(s) | |
Digest::SHA1.hexdigest(s) | |
end | |
backup_dir = '1b345454cbec76848e94c41ce0a2d6b7328973e9' | |
backup_path = "#{ENV['HOME']}/Library/Application Support/MobileSync/Backup/#{backup_dir}" | |
domain = "CameraRollDomain" | |
file = "Media/PhotoData/Photos.sqlite" | |
hash = sha1 "#{domain}-#{file}" | |
db = SQLite3::Database.new "#{backup_path}/#{hash}" | |
db.execute("select zdirectory, ZFILENAME from zgenericasset").each do |row| | |
puts row[1] | |
hash = sha1 "#{domain}-Media/#{row.join('/')}" | |
system "cp '#{backup_path}/#{hash}' media/#{row[1]}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment