Skip to content

Instantly share code, notes, and snippets.

@seventhsense
Last active July 18, 2018 21:07
Show Gist options
  • Save seventhsense/b353507fd08cb8733216de8bdd2999dd to your computer and use it in GitHub Desktop.
Save seventhsense/b353507fd08cb8733216de8bdd2999dd to your computer and use it in GitHub Desktop.
docxをmarkdownにまとめて変換するスクリプト(要pandoc)
#!/bin/bash
# 同一ディレクトリ上のdocxファイルをmdファイルに変換する.元ファイルは残る.
# refer https://qiita.com/kinagaki/items/460577f46529484d720e
dir=`pwd`
list=`find ${dir} -type f`
for file in $list; do
filename=`basename $file`
ext=${filename##*.}
if [[ $ext == "docx" ]]; then
echo $filename
basename=${filename%.*}
`pandoc $filename -t markdown-raw_html-native_divs-native_spans -o ${basename}.md `
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment