-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvert.sh
More file actions
executable file
·40 lines (31 loc) · 887 Bytes
/
Copy pathconvert.sh
File metadata and controls
executable file
·40 lines (31 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# this script will convert all docx to readme using pandoc
# it will also remove unnecessary doc, tmp, and rec.ck (for recording) files
for dir in */
do
cd ${dir}
echo "Entering ${dir}"
docx=(`find . -maxdepth 1 -name "*.docx"`)
doc=(`find . -maxdepth 1 -name "*.doc"`)
tmp=(`find . -maxdepth 1 -name "*~*"`)
rec=(`find . -maxdepth 1 -name "rec.ck"`)
# convert docx to readme
if [ ${#docx[@]} -gt 0 ]; then
echo "Converting ${docx##*/} to README"
pandoc ${docx} -t gfm -o README.md
fi
# remove .doc files
if [ ${#doc[@]} -gt 0 ]; then
echo "Removing ${doc##*/}"
rm *.doc
fi
# remove temp files
if [ ${#tmp[@]} -gt 0 ]; then
rm *~*
fi
# remove rec.ck files
if [ ${#rec[@]} -gt 0 ]; then
echo "Removing ${doc##*/}"
rm rec.ck
fi
cd ..
done