Last active
March 12, 2024 18:11
-
-
Save cwhittl/2e384fedc4aef449a87365d5a80340a2 to your computer and use it in GitHub Desktop.
Code to convert Supernotes stored in Dropbox
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
#!/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