Skip to content

Instantly share code, notes, and snippets.

@mlist
Created September 26, 2019 14:47
Show Gist options
  • Save mlist/4eda6d5d596d319b5f95eca8f55ce302 to your computer and use it in GitHub Desktop.
Save mlist/4eda6d5d596d319b5f95eca8f55ce302 to your computer and use it in GitHub Desktop.
bash script to batch convert all insync gddoc files in a folder to PDF
#!/bin/bash
#convert all gddoc documents to pdf
#needs jq: https://stedolan.github.io/jq/download/
shopt -s nullglob
for g in *.gddoc
do
url=$(jq -c '.url' $g)
url="${url%/edit?usp=drivesdk\"}"
url="${url#\"}"
echo "converting $url"
target="${url}/export?format=pdf&size=7"
wget -O "${g%.*}.pdf" "$target"
echo "done."
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment