Created
April 25, 2017 02:33
-
-
Save rvente/fcaa3e50ee88bc9f3b5b39d822937dc8 to your computer and use it in GitHub Desktop.
This removes unwanted characters from the filename of docx files, then uses w2m to convert it all to markdown, and prepones the needed YAML header also. This is for mass conversions of the files needed. It should work on any bash system with w2m installed.
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
for run in {1..10} ; do | |
for file in *.docx ; do | |
mv "${file}" "${file// _/ }" | |
mv "${file}" "${file/_}" | |
mv "${file}" "${file// }" | |
mv "${file}" "${file//,}" | |
done | |
done | |
for file in *.docx ; do | |
echo "--- | |
title: "" | |
categories: | |
- features | |
- news | |
- entertainment | |
- sports | |
- opinion | |
author: | |
--- | |
" > "${file%%}.md" | |
done | |
for file in *.docx ; do | |
w2m "${file}" >> "${file%%}.md" | |
done | |
for md in *.md ; do | |
mv "${md}" 2017-11-15-${md%%} | |
done | |
for file in *.md ; do | |
mv "${file}" "${file/.docx}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment