Skip to content

Instantly share code, notes, and snippets.

@cwhittl
Last active March 12, 2024 18:11
Show Gist options
  • Save cwhittl/2e384fedc4aef449a87365d5a80340a2 to your computer and use it in GitHub Desktop.
Save cwhittl/2e384fedc4aef449a87365d5a80340a2 to your computer and use it in GitHub Desktop.
Code to convert Supernotes stored in Dropbox
#!/bin/bash
#requires https://github.com/jya-dev/supernote-tool
superNotePath="/Users/chriswhittle/Dropbox/Supernote" #must be absolute if you are going to use cron
superNoteToolPath="/opt/homebrew/bin/supernote-tool" #must be absolute if you are going to use cron
superNoteNewExt="pdf"
find "${superNotePath}" -name "*.note" -print0 | while read -d $'\0' noteFile
do
convertedFile="${noteFile/Supernote/Supernote_Converted}"
convertedFile="${convertedFile%.*}.${superNoteNewExt}"
if [[ ! -f $convertedFile ]] || [[ $noteFile -nt $convertedFile ]] #make sure the converted file doesn't exist or the note is newer than last converted
then
newDir="$(dirname "${convertedFile}")"
mkdir -p "${newDir}"
eval "$superNoteToolPath convert -t pdf -a \"$noteFile\" \"$convertedFile\""
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment