Skip to content

Instantly share code, notes, and snippets.

@spagu
Created February 24, 2018 00:12
Show Gist options
  • Save spagu/5e2f3c95296dacb774bf530672670b5f to your computer and use it in GitHub Desktop.
Save spagu/5e2f3c95296dacb774bf530672670b5f to your computer and use it in GitHub Desktop.
Script to convert DOCX to HTML using bash and pandoc
#!/usr/bin/env bash
# use: ./docx-to-html.sh /folderpath/
find $1 -type f -name "*.docx" -print0 | while IFS= read -r -d $'\0' FINALNAME; do
BASENAME=$(basename "$FINALNAME" .docx)
DIRNAME=$(dirname "$FINALNAME")
echo "$FINALNAME"
pandoc -t html -o "$DIRNAME/$BASENAME.html" "$FINALNAME"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment