36 lines
743 B
Bash
Executable File
36 lines
743 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# defin the target dir
|
|
parent=$(dirname "${BASH_SOURCE[0]}")
|
|
cd $parent; cd ../../../
|
|
directory=$(pwd -P)
|
|
|
|
today=`date "+%Y-%m-%d"`
|
|
|
|
echo -e "Date: $today\n"
|
|
|
|
for dirs in "$directory"/*; do
|
|
string="---\n"
|
|
area=$(basename "${dirs}")
|
|
if [ "$area" != "System Volume Information" ]; then
|
|
|
|
string+="title: $area\n"
|
|
string+="date: $today\n"
|
|
string+="---\n\n"
|
|
for cats in "$dirs"/*; do
|
|
category=$(basename "${cats}")
|
|
string+="# $category\n\n"
|
|
for ids in "$cats"/*; do
|
|
ident=$(basename "${ids}")
|
|
string+="* $ident\n"
|
|
done
|
|
string+="\n"
|
|
done
|
|
savedir="$directory/00-09 Index/00 Index/00.01 Index/"
|
|
fname="${area:0:5}.md"
|
|
fullpath="$savedir$fname"
|
|
echo $fullpath
|
|
echo -e $string > "$fullpath"
|
|
fi
|
|
done
|