Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kerin
Created September 30, 2015 10:06
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kerin/925de8b57aca5dac40c6 to your computer and use it in GitHub Desktop.
Save kerin/925de8b57aca5dac40c6 to your computer and use it in GitHub Desktop.
simple bash script to convert .docx to .md, .html and .txt with pandoc
#!/usr/bin/env bash
find $1 -type f -name "*.docx" -print0 | while IFS= read -r -d $'\0' FNAME; do
BNAME=$(basename "$FNAME" .docx)
DNAME=$(dirname "$FNAME")
echo "$FNAME"
pandoc -t commonmark -o "$DNAME/$BNAME.md" "$FNAME"
pandoc -t html -o "$DNAME/$BNAME.html" "$FNAME"
pandoc -t plain -o "$DNAME/$BNAME.txt" "$FNAME"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment