Skip to content

Instantly share code, notes, and snippets.

@willonboy
Forked from 0xced/absim.sh
Created February 11, 2014 02:14
Show Gist options
  • Save willonboy/8928089 to your computer and use it in GitHub Desktop.
Save willonboy/8928089 to your computer and use it in GitHub Desktop.
#!/bin/bash
cd ~/Library/Application\ Support/MobileSync/Backup
backup=`ls -t1 | sed -n '1p'` # most recent backup
for f in "$backup"/*.mdinfo; do
grep -q "Library/AddressBook/AddressBook.sqlitedb" $f
if [ $? -eq 0 ]; then
addressbook=`basename $f .mdinfo`
cp -v "`pwd`/$backup/$addressbook.mddata" ~/Library/Application\ Support/iPhone\ Simulator/User/Library/AddressBook/AddressBook.sqlitedb
exit $?
fi
done
echo "Address Book not found in iPhone backup" >&2
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment