Skip to content

Instantly share code, notes, and snippets.

@aurorabbit
Created April 2, 2018 07:14
Show Gist options
  • Save aurorabbit/592bbc76df317f86c1a6ef64cc21244d to your computer and use it in GitHub Desktop.
Save aurorabbit/592bbc76df317f86c1a6ef64cc21244d to your computer and use it in GitHub Desktop.
iPhone favourite sync

Sync your favourited photos from your iOS device

Dependencies

brew.sh

brew install libimobiledevice
brew cask install osxfuse
brew install ifuse

Usage

Mount your device's filesystem

mkdir ~/iPhone
ifuse ~/iPhone

List your favourited photos

cd ~/iPhone
echo "SELECT ZDIRECTORY || '/' || ZFILENAME FROM ZGENERICASSET WHERE ZFAVORITE = 1;" | sqlite3 PhotoData/Photos.sqlite | tee favs.txt

Copy them to your computer

cd ~/iPhone
mkdir -p ~/Favourites
rsync -aP --files-from=favs.txt . ~/Favourites
#!/bin/sh
# first: ifuse ~/iPhone
output=~/Favourites
mkdir -p "$output"
cd ~/iPhone
echo "SELECT ZDIRECTORY || '/' || ZFILENAME FROM ZGENERICASSET WHERE ZFAVORITE = 1;" \
| sqlite3 PhotoData/Photos.sqlite \
| rsync -aP --files-from=- . "$output"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment