Skip to content

Instantly share code, notes, and snippets.

@pierwill
Created July 14, 2023 15:55
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 pierwill/53a38deb2f649a2843035958e455b0f6 to your computer and use it in GitHub Desktop.
Save pierwill/53a38deb2f649a2843035958e455b0f6 to your computer and use it in GitHub Desktop.
Export all iCloud voice memos
#! /bin/bash
newdir="allvoicememos"
mkdir $newdir
cd $newdir
OIFS=$IFS
IFS='|'
sqlite3 ~/Library/Application\ Support/com.apple.voicememos/Recordings/CloudRecordings.db "SELECT ZPATH, ZCUSTOMLABEL, ZDATE FROM ZCLOUDRECORDING" | while read line; do
thisline=($line)
location=${thisline[0]}
name=${thisline[1]}
date=${thisline[2]}
offset="978307200"
newdate=$(bc <<< "$date+$offset")
trimdate=${newdate%.*}
formatteddate=$(date -r $trimdate +%y%m%d%H%M.%S)
echo "Location: $location. Name: $name. Date: $date. New Date: $newdate. Trimdate: $trimdate. Formatted: $formatteddate New filename: $newfilename"
newfilename="./$name-$trimdate.m4a"
cp $location $newfilename
touch -a -m -t $formatteddate $newfilename
done
IFS=$OIFS
@pierwill
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment